Apply Dispose pattern to NUI.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Rotation.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Tizen.NUI
12 {
13
14     /// <summary>
15     /// Rotation Class
16     /// </summary>
17     public class Rotation : global::System.IDisposable
18     {
19         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20         protected bool swigCMemOwn;
21
22         internal Rotation(global::System.IntPtr cPtr, bool cMemoryOwn)
23         {
24             swigCMemOwn = cMemoryOwn;
25             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
26         }
27
28         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Rotation obj)
29         {
30             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
31         }
32
33         //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) 
34
35         //A Flag to check who called Dispose(). (By User or DisposeQueue)
36         private bool isDisposeQueued = false;
37         //A Flat to check if it is already disposed.
38         protected bool disposed = false;
39
40         ~Rotation()
41         {
42             if(!isDisposeQueued)
43             {
44                 isDisposeQueued = true;
45                 DisposeQueue.Instance.Add(this);
46             }
47         }
48
49         /// <summary>
50         /// To make Rotation instance be disposed.
51         /// </summary>
52         public void Dispose()
53         {
54             //Throw excpetion if Dispose() is called in separate thread.
55             if (!Window.IsInstalled())
56             {
57                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
58             }
59
60             if (isDisposeQueued)
61             {
62                 Dispose(DisposeTypes.Implicit);
63             }
64             else
65             {
66                 Dispose(DisposeTypes.Explicit);
67                 System.GC.SuppressFinalize(this);
68             }
69         }
70
71         protected virtual void Dispose(DisposeTypes type)
72         {
73             if (disposed)
74             {
75                 return;
76             }
77
78             if(type == DisposeTypes.Explicit)
79             {
80                 //Called by User
81                 //Release your own managed resources here.
82                 //You should release all of your own disposable objects here.
83             }
84
85             //Release your own unmanaged resources here.
86             //You should not access any managed member here except static instance.
87             //because the execution order of Finalizes is non-deterministic.
88
89             if (swigCPtr.Handle != global::System.IntPtr.Zero)
90             {
91                 if (swigCMemOwn)
92                 {
93                     swigCMemOwn = false;
94                     NDalicPINVOKE.delete_Rotation(swigCPtr);
95                 }
96                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
97             }
98             disposed = true;
99         }
100
101         /// <summary>
102         /// Addition operator.
103         /// </summary>
104         /// <param name="arg1">First Rotation</param>
105         /// <param name="arg2">Second Rotation</param>
106         /// <returns>A Rotation containing the result of the Addition</returns>
107         public static Rotation operator +(Rotation arg1, Rotation arg2)
108         {
109             return arg1.Add(arg2);
110         }
111
112         /// <summary>
113         /// Subtraction operator.
114         /// </summary>
115         /// <param name="arg1">First Rotation</param>
116         /// <param name="arg2">Second Rotation</param>
117         /// <returns>A Rotation containing the result of the subtract</returns>
118         public static Rotation operator -(Rotation arg1, Rotation arg2)
119         {
120             return arg1.Subtract(arg2);
121         }
122
123         /// <summary>
124         /// Unary Negation operator.
125         /// </summary>
126         /// <param name="arg1">First Rotation</param>
127         /// <returns>A Rotation containing the negated result</returns>
128         public static Rotation operator -(Rotation arg1)
129         {
130             return arg1.Subtract();
131         }
132
133         /// <summary>
134         /// Multiplication operator.
135         /// </summary>
136         /// <param name="arg1">First Rotation</param>
137         /// <param name="arg2">Second Rotation</param>
138         /// <returns>A Rotation containing the result of the Multiplication</returns>
139         public static Rotation operator *(Rotation arg1, Rotation arg2)
140         {
141             return arg1.Multiply(arg2);
142         }
143
144         /// <summary>
145         /// Multiplication operator.
146         /// </summary>
147         /// <param name="arg1">Rotation</param>
148         /// <param name="arg2">The vector to multiply</param>
149         /// <returns>A Rotation containing the result of the multiplication</returns>
150         public static Vector3 operator *(Rotation arg1, Vector3 arg2)
151         {
152             return arg1.Multiply(arg2);
153         }
154
155         /// <summary>
156         /// Scale operator.
157         /// </summary>
158         /// <param name="arg1">Rotation</param>
159         /// <param name="arg2">A value to scale by</param>
160         /// <returns>A Rotation containing the result of the scaling</returns>
161         public static Rotation operator *(Rotation arg1, float arg2)
162         {
163             return arg1.Multiply(arg2);
164         }
165
166         /// <summary>
167         /// Division operator.
168         /// </summary>
169         /// <param name="arg1">First Rotation</param>
170         /// <param name="arg2">Second Rotation</param>
171         /// <returns>A Rotation containing the result of the scaling</returns>
172         public static Rotation operator /(Rotation arg1, Rotation arg2)
173         {
174             return arg1.Divide(arg2);
175         }
176
177         /// <summary>
178         /// Scale operator.
179         /// </summary>
180         /// <param name="arg1">Rotation</param>
181         /// <param name="arg2">A value to scale by</param>
182         /// <returns>A Rotation containing the result of the scaling</returns>
183         public static Rotation operator /(Rotation arg1, float arg2)
184         {
185             return arg1.Divide(arg2);
186         }
187
188         /// <summary>
189         /// Default Constructor.
190         /// </summary>
191         public Rotation() : this(NDalicPINVOKE.new_Rotation__SWIG_0(), true)
192         {
193             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194         }
195
196         /// <summary>
197         /// Constructor from an axis and angle.
198         /// </summary>
199         /// <param name="angle">The angle around the axis</param>
200         /// <param name="axis">The vector of the axis</param>
201         public Rotation(Radian angle, Vector3 axis) : this(NDalicPINVOKE.new_Rotation__SWIG_1(Radian.getCPtr(angle), Vector3.getCPtr(axis)), true)
202         {
203             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204         }
205
206         /// <summary>
207         /// (0.0f,0.0f,0.0f,1.0f)
208         /// </summary>
209         public static Rotation IDENTITY
210         {
211             get
212             {
213                 global::System.IntPtr cPtr = NDalicPINVOKE.Rotation_IDENTITY_get();
214                 Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, false);
215                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216                 return ret;
217             }
218         }
219
220         /// <summary>
221         /// Helper to check if this is an identity quaternion.
222         /// </summary>
223         /// <returns>True if this is identity quaternion</returns>
224         public bool IsIdentity()
225         {
226             bool ret = NDalicPINVOKE.Rotation_IsIdentity(swigCPtr);
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228             return ret;
229         }
230
231         /// <summary>
232         /// Converts the quaternion to an axis/angle pair.
233         /// </summary>
234         /// <param name="axis">the result of axis</param>
235         /// <param name="angle">the result of angle Angle in radians</param>
236         /// <returns>True if converted correctly</returns>
237         public bool GetAxisAngle(Vector3 axis, Radian angle)
238         {
239             bool ret = NDalicPINVOKE.Rotation_GetAxisAngle(swigCPtr, Vector3.getCPtr(axis), Radian.getCPtr(angle));
240             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241             return ret;
242         }
243
244         private Rotation Add(Rotation other)
245         {
246             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Add(swigCPtr, Rotation.getCPtr(other)), true);
247             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248             return ret;
249         }
250
251         private Rotation Subtract(Rotation other)
252         {
253             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
254             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255             return ret;
256         }
257
258         private Rotation Multiply(Rotation other)
259         {
260             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
261             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262             return ret;
263         }
264
265         private Vector3 Multiply(Vector3 other)
266         {
267             Vector3 ret = new Vector3(NDalicPINVOKE.Rotation_Multiply__SWIG_1(swigCPtr, Vector3.getCPtr(other)), true);
268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269             return ret;
270         }
271
272         private Rotation Divide(Rotation other)
273         {
274             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
275             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276             return ret;
277         }
278
279         private Rotation Multiply(float scale)
280         {
281             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_2(swigCPtr, scale), true);
282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283             return ret;
284         }
285
286         private Rotation Divide(float scale)
287         {
288             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_1(swigCPtr, scale), true);
289             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290             return ret;
291         }
292
293         private Rotation Subtract()
294         {
295             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_1(swigCPtr), true);
296             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297             return ret;
298         }
299
300         private Rotation AddAssign(Rotation other)
301         {
302             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_AddAssign(swigCPtr, Rotation.getCPtr(other)), false);
303             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304             return ret;
305         }
306
307         private Rotation SubtractAssign(Rotation other)
308         {
309             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SubtractAssign(swigCPtr, Rotation.getCPtr(other)), false);
310             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311             return ret;
312         }
313
314         private Rotation MultiplyAssign(Rotation other)
315         {
316             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_0(swigCPtr, Rotation.getCPtr(other)), false);
317             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318             return ret;
319         }
320
321         private Rotation MultiplyAssign(float scale)
322         {
323             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_1(swigCPtr, scale), false);
324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325             return ret;
326         }
327
328         private Rotation DivideAssign(float scale)
329         {
330             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_DivideAssign(swigCPtr, scale), false);
331             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332             return ret;
333         }
334
335         private bool EqualTo(Rotation rhs)
336         {
337             bool ret = NDalicPINVOKE.Rotation_EqualTo(swigCPtr, Rotation.getCPtr(rhs));
338             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
339             return ret;
340         }
341
342         private bool NotEqualTo(Rotation rhs)
343         {
344             bool ret = NDalicPINVOKE.Rotation_NotEqualTo(swigCPtr, Rotation.getCPtr(rhs));
345             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346             return ret;
347         }
348
349         /// <summary>
350         /// Returns the length of the rotation
351         /// </summary>
352         /// <returns>The length of the rotation</returns>
353         public float Length()
354         {
355             float ret = NDalicPINVOKE.Rotation_Length(swigCPtr);
356             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357             return ret;
358         }
359
360         /// <summary>
361         /// Returns the squared length of the rotation
362         /// </summary>
363         /// <returns>The squared length of the rotation</returns>
364         public float LengthSquared()
365         {
366             float ret = NDalicPINVOKE.Rotation_LengthSquared(swigCPtr);
367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368             return ret;
369         }
370
371         /// <summary>
372         /// Normalizes this to unit length.
373         /// </summary>
374         public void Normalize()
375         {
376             NDalicPINVOKE.Rotation_Normalize(swigCPtr);
377             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
378         }
379
380         /// <summary>
381         /// Normalized.
382         /// </summary>
383         /// <returns>A normalized version of this rotation</returns>
384         public Rotation Normalized()
385         {
386             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Normalized(swigCPtr), true);
387             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388             return ret;
389         }
390
391         /// <summary>
392         /// Conjugates this rotation.
393         /// </summary>
394         public void Conjugate()
395         {
396             NDalicPINVOKE.Rotation_Conjugate(swigCPtr);
397             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398         }
399
400         /// <summary>
401         /// Inverts this rotation.
402         /// </summary>
403         public void Invert()
404         {
405             NDalicPINVOKE.Rotation_Invert(swigCPtr);
406             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407         }
408
409         /// <summary>
410         /// Performs the logarithm of a rotation
411         /// </summary>
412         /// <returns>A rotation representing the logarithm</returns>
413         public Rotation Log()
414         {
415             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Log(swigCPtr), true);
416             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417             return ret;
418         }
419
420         /// <summary>
421         /// Performs an exponent
422         /// </summary>
423         /// <returns>A rotation representing the exponent</returns>
424         public Rotation Exp()
425         {
426             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Exp(swigCPtr), true);
427             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428             return ret;
429         }
430
431         /// <summary>
432         /// Returns the dot product of two rotations.
433         /// </summary>
434         /// <param name="q1">The first rotation</param>
435         /// <param name="q2">The second rotation</param>
436         /// <returns>The dot product of the two rotations</returns>
437         public static float Dot(Rotation q1, Rotation q2)
438         {
439             float ret = NDalicPINVOKE.Rotation_Dot(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
440             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441             return ret;
442         }
443
444         /// <summary>
445         /// Linear Interpolation (using a straight line between the two rotations).
446         /// </summary>
447         /// <param name="q1">The start rotation</param>
448         /// <param name="q2">The end rotation</param>
449         /// <param name="t">A progress value between 0 and 1</param>
450         /// <returns>The interpolated rotation</returns>
451         public static Rotation Lerp(Rotation q1, Rotation q2, float t)
452         {
453             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Lerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true);
454             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
455             return ret;
456         }
457
458         /// <summary>
459         /// Spherical Linear Interpolation (using the shortest arc of a great circle between the two rotations).
460         /// </summary>
461         /// <param name="q1">The start rotation</param>
462         /// <param name="q2">The end rotation</param>
463         /// <param name="progress">A progress value between 0 and 1</param>
464         /// <returns>The interpolated rotation</returns>
465         public static Rotation Slerp(Rotation q1, Rotation q2, float progress)
466         {
467             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Slerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), progress), true);
468             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
469             return ret;
470         }
471
472         /// <summary>
473         /// This version of Slerp, used by Squad, does not check for theta > 90.
474         /// </summary>
475         /// <param name="q1">The start rotation</param>
476         /// <param name="q2">The end rotation</param>
477         /// <param name="t">A progress value between 0 and 1</param>
478         /// <returns>The interpolated rotation</returns>
479         public static Rotation SlerpNoInvert(Rotation q1, Rotation q2, float t)
480         {
481             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SlerpNoInvert(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true);
482             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
483             return ret;
484         }
485
486         /// <summary>
487         /// Spherical Cubic Interpolation.
488         /// </summary>
489         /// <param name="start">The start rotation</param>
490         /// <param name="end">The end rotation</param>
491         /// <param name="ctrl1">The control rotation for q1</param>
492         /// <param name="ctrl2">The control rotation for q2</param>
493         /// <param name="t">A progress value between 0 and 1</param>
494         /// <returns>The interpolated rotation</returns>
495         public static Rotation Squad(Rotation start, Rotation end, Rotation ctrl1, Rotation ctrl2, float t)
496         {
497             Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Squad(Rotation.getCPtr(start), Rotation.getCPtr(end), Rotation.getCPtr(ctrl1), Rotation.getCPtr(ctrl2), t), true);
498             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499             return ret;
500         }
501
502         /// <summary>
503         /// Returns the shortest angle between two rotations in Radians.
504         /// </summary>
505         /// <param name="q1">The first rotation</param>
506         /// <param name="q2">The second rotation</param>
507         /// <returns>The angle between the two rotation</returns>
508         public static float AngleBetween(Rotation q1, Rotation q2)
509         {
510             float ret = NDalicPINVOKE.Rotation_AngleBetween(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
511             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512             return ret;
513         }
514
515     }
516
517 }