1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
17 public class Rotation : global::System.IDisposable
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20 protected bool swigCMemOwn;
22 internal Rotation(global::System.IntPtr cPtr, bool cMemoryOwn)
24 swigCMemOwn = cMemoryOwn;
25 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Rotation obj)
30 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33 //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam)
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;
44 isDisposeQueued = true;
45 DisposeQueue.Instance.Add(this);
50 /// To make Rotation instance be disposed.
54 //Throw excpetion if Dispose() is called in separate thread.
55 if (!Window.IsInstalled())
57 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
62 Dispose(DisposeTypes.Implicit);
66 Dispose(DisposeTypes.Explicit);
67 System.GC.SuppressFinalize(this);
71 protected virtual void Dispose(DisposeTypes type)
78 if(type == DisposeTypes.Explicit)
81 //Release your own managed resources here.
82 //You should release all of your own disposable objects here.
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.
89 if (swigCPtr.Handle != global::System.IntPtr.Zero)
94 NDalicPINVOKE.delete_Rotation(swigCPtr);
96 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
102 /// Addition operator.
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)
109 return arg1.Add(arg2);
113 /// Subtraction operator.
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)
120 return arg1.Subtract(arg2);
124 /// Unary Negation operator.
126 /// <param name="arg1">First Rotation</param>
127 /// <returns>A Rotation containing the negated result</returns>
128 public static Rotation operator -(Rotation arg1)
130 return arg1.Subtract();
134 /// Multiplication operator.
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)
141 return arg1.Multiply(arg2);
145 /// Multiplication operator.
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)
152 return arg1.Multiply(arg2);
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)
163 return arg1.Multiply(arg2);
167 /// Division operator.
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)
174 return arg1.Divide(arg2);
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)
185 return arg1.Divide(arg2);
189 /// Default Constructor.
191 public Rotation() : this(NDalicPINVOKE.new_Rotation__SWIG_0(), true)
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 /// Constructor from an axis and angle.
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)
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 /// (0.0f,0.0f,0.0f,1.0f)
209 public static Rotation IDENTITY
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();
221 /// Helper to check if this is an identity quaternion.
223 /// <returns>True if this is identity quaternion</returns>
224 public bool IsIdentity()
226 bool ret = NDalicPINVOKE.Rotation_IsIdentity(swigCPtr);
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 /// Converts the quaternion to an axis/angle pair.
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)
239 bool ret = NDalicPINVOKE.Rotation_GetAxisAngle(swigCPtr, Vector3.getCPtr(axis), Radian.getCPtr(angle));
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 private Rotation Add(Rotation other)
246 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Add(swigCPtr, Rotation.getCPtr(other)), true);
247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251 private Rotation Subtract(Rotation other)
253 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 private Rotation Multiply(Rotation other)
260 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 private Vector3 Multiply(Vector3 other)
267 Vector3 ret = new Vector3(NDalicPINVOKE.Rotation_Multiply__SWIG_1(swigCPtr, Vector3.getCPtr(other)), true);
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 private Rotation Divide(Rotation other)
274 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 private Rotation Multiply(float scale)
281 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_2(swigCPtr, scale), true);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 private Rotation Divide(float scale)
288 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_1(swigCPtr, scale), true);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293 private Rotation Subtract()
295 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_1(swigCPtr), true);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 private Rotation AddAssign(Rotation other)
302 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_AddAssign(swigCPtr, Rotation.getCPtr(other)), false);
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 private Rotation SubtractAssign(Rotation other)
309 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SubtractAssign(swigCPtr, Rotation.getCPtr(other)), false);
310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 private Rotation MultiplyAssign(Rotation other)
316 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_0(swigCPtr, Rotation.getCPtr(other)), false);
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 private Rotation MultiplyAssign(float scale)
323 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_1(swigCPtr, scale), false);
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 private Rotation DivideAssign(float scale)
330 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_DivideAssign(swigCPtr, scale), false);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335 private bool EqualTo(Rotation rhs)
337 bool ret = NDalicPINVOKE.Rotation_EqualTo(swigCPtr, Rotation.getCPtr(rhs));
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 private bool NotEqualTo(Rotation rhs)
344 bool ret = NDalicPINVOKE.Rotation_NotEqualTo(swigCPtr, Rotation.getCPtr(rhs));
345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
350 /// Returns the length of the rotation
352 /// <returns>The length of the rotation</returns>
353 public float Length()
355 float ret = NDalicPINVOKE.Rotation_Length(swigCPtr);
356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 /// Returns the squared length of the rotation
363 /// <returns>The squared length of the rotation</returns>
364 public float LengthSquared()
366 float ret = NDalicPINVOKE.Rotation_LengthSquared(swigCPtr);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372 /// Normalizes this to unit length.
374 public void Normalize()
376 NDalicPINVOKE.Rotation_Normalize(swigCPtr);
377 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383 /// <returns>A normalized version of this rotation</returns>
384 public Rotation Normalized()
386 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Normalized(swigCPtr), true);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 /// Conjugates this rotation.
394 public void Conjugate()
396 NDalicPINVOKE.Rotation_Conjugate(swigCPtr);
397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
401 /// Inverts this rotation.
405 NDalicPINVOKE.Rotation_Invert(swigCPtr);
406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410 /// Performs the logarithm of a rotation
412 /// <returns>A rotation representing the logarithm</returns>
413 public Rotation Log()
415 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Log(swigCPtr), true);
416 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 /// Performs an exponent
423 /// <returns>A rotation representing the exponent</returns>
424 public Rotation Exp()
426 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Exp(swigCPtr), true);
427 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
432 /// Returns the dot product of two rotations.
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)
439 float ret = NDalicPINVOKE.Rotation_Dot(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
445 /// Linear Interpolation (using a straight line between the two rotations).
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)
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();
459 /// Spherical Linear Interpolation (using the shortest arc of a great circle between the two rotations).
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)
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();
473 /// This version of Slerp, used by Squad, does not check for theta > 90.
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)
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();
487 /// Spherical Cubic Interpolation.
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)
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();
503 /// Returns the shortest angle between two rotations in Radians.
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)
510 float ret = NDalicPINVOKE.Rotation_AngleBetween(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
511 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();