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 //A Flag to check who called Dispose(). (By User or DisposeQueue)
34 private bool isDisposeQueued = false;
35 //A Flat to check if it is already disposed.
36 protected bool disposed = false;
42 isDisposeQueued = true;
43 DisposeQueue.Instance.Add(this);
48 /// To make Rotation instance be disposed.
52 //Throw excpetion if Dispose() is called in separate thread.
53 if (!Window.IsInstalled())
55 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
60 Dispose(DisposeTypes.Implicit);
64 Dispose(DisposeTypes.Explicit);
65 System.GC.SuppressFinalize(this);
69 protected virtual void Dispose(DisposeTypes type)
76 if(type == DisposeTypes.Explicit)
79 //Release your own managed resources here.
80 //You should release all of your own disposable objects here.
83 //Release your own unmanaged resources here.
84 //You should not access any managed member here except static instance.
85 //because the execution order of Finalizes is non-deterministic.
87 if (swigCPtr.Handle != global::System.IntPtr.Zero)
92 NDalicPINVOKE.delete_Rotation(swigCPtr);
94 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
100 /// Addition operator.
102 /// <param name="arg1">First Rotation</param>
103 /// <param name="arg2">Second Rotation</param>
104 /// <returns>A Rotation containing the result of the Addition</returns>
105 public static Rotation operator +(Rotation arg1, Rotation arg2)
107 return arg1.Add(arg2);
111 /// Subtraction operator.
113 /// <param name="arg1">First Rotation</param>
114 /// <param name="arg2">Second Rotation</param>
115 /// <returns>A Rotation containing the result of the subtract</returns>
116 public static Rotation operator -(Rotation arg1, Rotation arg2)
118 return arg1.Subtract(arg2);
122 /// Unary Negation operator.
124 /// <param name="arg1">First Rotation</param>
125 /// <returns>A Rotation containing the negated result</returns>
126 public static Rotation operator -(Rotation arg1)
128 return arg1.Subtract();
132 /// Multiplication operator.
134 /// <param name="arg1">First Rotation</param>
135 /// <param name="arg2">Second Rotation</param>
136 /// <returns>A Rotation containing the result of the Multiplication</returns>
137 public static Rotation operator *(Rotation arg1, Rotation arg2)
139 return arg1.Multiply(arg2);
143 /// Multiplication operator.
145 /// <param name="arg1">Rotation</param>
146 /// <param name="arg2">The vector to multiply</param>
147 /// <returns>A Rotation containing the result of the multiplication</returns>
148 public static Vector3 operator *(Rotation arg1, Vector3 arg2)
150 return arg1.Multiply(arg2);
156 /// <param name="arg1">Rotation</param>
157 /// <param name="arg2">A value to scale by</param>
158 /// <returns>A Rotation containing the result of the scaling</returns>
159 public static Rotation operator *(Rotation arg1, float arg2)
161 return arg1.Multiply(arg2);
165 /// Division operator.
167 /// <param name="arg1">First Rotation</param>
168 /// <param name="arg2">Second Rotation</param>
169 /// <returns>A Rotation containing the result of the scaling</returns>
170 public static Rotation operator /(Rotation arg1, Rotation arg2)
172 return arg1.Divide(arg2);
178 /// <param name="arg1">Rotation</param>
179 /// <param name="arg2">A value to scale by</param>
180 /// <returns>A Rotation containing the result of the scaling</returns>
181 public static Rotation operator /(Rotation arg1, float arg2)
183 return arg1.Divide(arg2);
187 /// Default Constructor.
189 public Rotation() : this(NDalicPINVOKE.new_Rotation__SWIG_0(), true)
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 /// Constructor from an axis and angle.
197 /// <param name="angle">The angle around the axis</param>
198 /// <param name="axis">The vector of the axis</param>
199 public Rotation(Radian angle, Vector3 axis) : this(NDalicPINVOKE.new_Rotation__SWIG_1(Radian.getCPtr(angle), Vector3.getCPtr(axis)), true)
201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 /// (0.0f,0.0f,0.0f,1.0f)
207 public static Rotation IDENTITY
211 global::System.IntPtr cPtr = NDalicPINVOKE.Rotation_IDENTITY_get();
212 Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, false);
213 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 /// Helper to check if this is an identity quaternion.
221 /// <returns>True if this is identity quaternion</returns>
222 public bool IsIdentity()
224 bool ret = NDalicPINVOKE.Rotation_IsIdentity(swigCPtr);
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 /// Converts the quaternion to an axis/angle pair.
232 /// <param name="axis">the result of axis</param>
233 /// <param name="angle">the result of angle Angle in radians</param>
234 /// <returns>True if converted correctly</returns>
235 public bool GetAxisAngle(Vector3 axis, Radian angle)
237 bool ret = NDalicPINVOKE.Rotation_GetAxisAngle(swigCPtr, Vector3.getCPtr(axis), Radian.getCPtr(angle));
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242 private Rotation Add(Rotation other)
244 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Add(swigCPtr, Rotation.getCPtr(other)), true);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 private Rotation Subtract(Rotation other)
251 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 private Rotation Multiply(Rotation other)
258 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 private Vector3 Multiply(Vector3 other)
265 Vector3 ret = new Vector3(NDalicPINVOKE.Rotation_Multiply__SWIG_1(swigCPtr, Vector3.getCPtr(other)), true);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 private Rotation Divide(Rotation other)
272 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 private Rotation Multiply(float scale)
279 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_2(swigCPtr, scale), true);
280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284 private Rotation Divide(float scale)
286 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_1(swigCPtr, scale), true);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291 private Rotation Subtract()
293 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_1(swigCPtr), true);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 private Rotation AddAssign(Rotation other)
300 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_AddAssign(swigCPtr, Rotation.getCPtr(other)), false);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 private Rotation SubtractAssign(Rotation other)
307 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SubtractAssign(swigCPtr, Rotation.getCPtr(other)), false);
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 private Rotation MultiplyAssign(Rotation other)
314 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_0(swigCPtr, Rotation.getCPtr(other)), false);
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
319 private Rotation MultiplyAssign(float scale)
321 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_1(swigCPtr, scale), false);
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326 private Rotation DivideAssign(float scale)
328 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_DivideAssign(swigCPtr, scale), false);
329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333 private bool EqualTo(Rotation rhs)
335 bool ret = NDalicPINVOKE.Rotation_EqualTo(swigCPtr, Rotation.getCPtr(rhs));
336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 private bool NotEqualTo(Rotation rhs)
342 bool ret = NDalicPINVOKE.Rotation_NotEqualTo(swigCPtr, Rotation.getCPtr(rhs));
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
348 /// Returns the length of the rotation
350 /// <returns>The length of the rotation</returns>
351 public float Length()
353 float ret = NDalicPINVOKE.Rotation_Length(swigCPtr);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359 /// Returns the squared length of the rotation
361 /// <returns>The squared length of the rotation</returns>
362 public float LengthSquared()
364 float ret = NDalicPINVOKE.Rotation_LengthSquared(swigCPtr);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 /// Normalizes this to unit length.
372 public void Normalize()
374 NDalicPINVOKE.Rotation_Normalize(swigCPtr);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 /// <returns>A normalized version of this rotation</returns>
382 public Rotation Normalized()
384 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Normalized(swigCPtr), true);
385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
390 /// Conjugates this rotation.
392 public void Conjugate()
394 NDalicPINVOKE.Rotation_Conjugate(swigCPtr);
395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399 /// Inverts this rotation.
403 NDalicPINVOKE.Rotation_Invert(swigCPtr);
404 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
408 /// Performs the logarithm of a rotation
410 /// <returns>A rotation representing the logarithm</returns>
411 public Rotation Log()
413 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Log(swigCPtr), true);
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419 /// Performs an exponent
421 /// <returns>A rotation representing the exponent</returns>
422 public Rotation Exp()
424 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Exp(swigCPtr), true);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// Returns the dot product of two rotations.
432 /// <param name="q1">The first rotation</param>
433 /// <param name="q2">The second rotation</param>
434 /// <returns>The dot product of the two rotations</returns>
435 public static float Dot(Rotation q1, Rotation q2)
437 float ret = NDalicPINVOKE.Rotation_Dot(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
443 /// Linear Interpolation (using a straight line between the two rotations).
445 /// <param name="q1">The start rotation</param>
446 /// <param name="q2">The end rotation</param>
447 /// <param name="t">A progress value between 0 and 1</param>
448 /// <returns>The interpolated rotation</returns>
449 public static Rotation Lerp(Rotation q1, Rotation q2, float t)
451 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Lerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true);
452 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 /// Spherical Linear Interpolation (using the shortest arc of a great circle between the two rotations).
459 /// <param name="q1">The start rotation</param>
460 /// <param name="q2">The end rotation</param>
461 /// <param name="progress">A progress value between 0 and 1</param>
462 /// <returns>The interpolated rotation</returns>
463 public static Rotation Slerp(Rotation q1, Rotation q2, float progress)
465 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Slerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), progress), true);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471 /// This version of Slerp, used by Squad, does not check for theta > 90.
473 /// <param name="q1">The start rotation</param>
474 /// <param name="q2">The end rotation</param>
475 /// <param name="t">A progress value between 0 and 1</param>
476 /// <returns>The interpolated rotation</returns>
477 public static Rotation SlerpNoInvert(Rotation q1, Rotation q2, float t)
479 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SlerpNoInvert(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true);
480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
485 /// Spherical Cubic Interpolation.
487 /// <param name="start">The start rotation</param>
488 /// <param name="end">The end rotation</param>
489 /// <param name="ctrl1">The control rotation for q1</param>
490 /// <param name="ctrl2">The control rotation for q2</param>
491 /// <param name="t">A progress value between 0 and 1</param>
492 /// <returns>The interpolated rotation</returns>
493 public static Rotation Squad(Rotation start, Rotation end, Rotation ctrl1, Rotation ctrl2, float t)
495 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Squad(Rotation.getCPtr(start), Rotation.getCPtr(end), Rotation.getCPtr(ctrl1), Rotation.getCPtr(ctrl2), t), true);
496 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
501 /// Returns the shortest angle between two rotations in Radians.
503 /// <param name="q1">The first rotation</param>
504 /// <param name="q2">The second rotation</param>
505 /// <returns>The angle between the two rotation</returns>
506 public static float AngleBetween(Rotation q1, Rotation q2)
508 float ret = NDalicPINVOKE.Rotation_AngleBetween(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
509 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();