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;
35 DisposeQueue.Instance.Add(this);
38 public virtual void Dispose()
40 if (!Stage.IsInstalled())
42 DisposeQueue.Instance.Add(this);
48 if (swigCPtr.Handle != global::System.IntPtr.Zero)
53 NDalicPINVOKE.delete_Rotation(swigCPtr);
55 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
57 global::System.GC.SuppressFinalize(this);
62 /// Addition operator.
64 /// <param name="arg1">First Rotation</param>
65 /// <param name="arg2">Second Rotation</param>
66 /// <returns>A Rotation containing the result of the Addition</returns>
67 public static Rotation operator +(Rotation arg1, Rotation arg2)
69 return arg1.Add(arg2);
73 /// Subtraction operator.
75 /// <param name="arg1">First Rotation</param>
76 /// <param name="arg2">Second Rotation</param>
77 /// <returns>A Rotation containing the result of the subtract</returns>
78 public static Rotation operator -(Rotation arg1, Rotation arg2)
80 return arg1.Subtract(arg2);
84 /// Unary Negation operator.
86 /// <param name="arg1">First Rotation</param>
87 /// <returns>A Rotation containing the negated result</returns>
88 public static Rotation operator -(Rotation arg1)
90 return arg1.Subtract();
94 /// Multiplication operator.
96 /// <param name="arg1">First Rotation</param>
97 /// <param name="arg2">Second Rotation</param>
98 /// <returns>A Rotation containing the result of the Multiplication</returns>
99 public static Rotation operator *(Rotation arg1, Rotation arg2)
101 return arg1.Multiply(arg2);
105 /// Multiplication operator.
107 /// <param name="arg1">Rotation</param>
108 /// <param name="arg2">The vector to multiply</param>
109 /// <returns>A Rotation containing the result of the multiplication</returns>
110 public static Vector3 operator *(Rotation arg1, Vector3 arg2)
112 return arg1.Multiply(arg2);
118 /// <param name="arg1">Rotation</param>
119 /// <param name="arg2">A value to scale by</param>
120 /// <returns>A Rotation containing the result of the scaling</returns>
121 public static Rotation operator *(Rotation arg1, float arg2)
123 return arg1.Multiply(arg2);
127 /// Division operator.
129 /// <param name="arg1">First Rotation</param>
130 /// <param name="arg2">Second Rotation</param>
131 /// <returns>A Rotation containing the result of the scaling</returns>
132 public static Rotation operator /(Rotation arg1, Rotation arg2)
134 return arg1.Divide(arg2);
140 /// <param name="arg1">Rotation</param>
141 /// <param name="arg2">A value to scale by</param>
142 /// <returns>A Rotation containing the result of the scaling</returns>
143 public static Rotation operator /(Rotation arg1, float arg2)
145 return arg1.Divide(arg2);
149 /// Default Constructor.
151 public Rotation() : this(NDalicPINVOKE.new_Rotation__SWIG_0(), true)
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 /// Constructor from an axis and angle.
159 /// <param name="angle">The angle around the axis</param>
160 /// <param name="axis">The vector of the axis</param>
161 public Rotation(Radian angle, Vector3 axis) : this(NDalicPINVOKE.new_Rotation__SWIG_1(Radian.getCPtr(angle), Vector3.getCPtr(axis)), true)
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// (0.0f,0.0f,0.0f,1.0f)
169 public static Rotation IDENTITY
173 global::System.IntPtr cPtr = NDalicPINVOKE.Rotation_IDENTITY_get();
174 Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, false);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// Helper to check if this is an identity quaternion.
183 /// <returns>True if this is identity quaternion</returns>
184 public bool IsIdentity()
186 bool ret = NDalicPINVOKE.Rotation_IsIdentity(swigCPtr);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 /// Converts the quaternion to an axis/angle pair.
194 /// <param name="axis">the result of axis</param>
195 /// <param name="angle">the result of angle Angle in radians</param>
196 /// <returns>True if converted correctly</returns>
197 public bool GetAxisAngle(Vector3 axis, Radian angle)
199 bool ret = NDalicPINVOKE.Rotation_GetAxisAngle(swigCPtr, Vector3.getCPtr(axis), Radian.getCPtr(angle));
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 private Rotation Add(Rotation other)
206 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Add(swigCPtr, Rotation.getCPtr(other)), true);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 private Rotation Subtract(Rotation other)
213 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 private Rotation Multiply(Rotation other)
220 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 private Vector3 Multiply(Vector3 other)
227 Vector3 ret = new Vector3(NDalicPINVOKE.Rotation_Multiply__SWIG_1(swigCPtr, Vector3.getCPtr(other)), true);
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 private Rotation Divide(Rotation other)
234 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true);
235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239 private Rotation Multiply(float scale)
241 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_2(swigCPtr, scale), true);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 private Rotation Divide(float scale)
248 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_1(swigCPtr, scale), true);
249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 private Rotation Subtract()
255 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_1(swigCPtr), true);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 private Rotation AddAssign(Rotation other)
262 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_AddAssign(swigCPtr, Rotation.getCPtr(other)), false);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 private Rotation SubtractAssign(Rotation other)
269 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SubtractAssign(swigCPtr, Rotation.getCPtr(other)), false);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 private Rotation MultiplyAssign(Rotation other)
276 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_0(swigCPtr, Rotation.getCPtr(other)), false);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281 private Rotation MultiplyAssign(float scale)
283 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_1(swigCPtr, scale), false);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 private Rotation DivideAssign(float scale)
290 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_DivideAssign(swigCPtr, scale), false);
291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 private bool EqualTo(Rotation rhs)
297 bool ret = NDalicPINVOKE.Rotation_EqualTo(swigCPtr, Rotation.getCPtr(rhs));
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302 private bool NotEqualTo(Rotation rhs)
304 bool ret = NDalicPINVOKE.Rotation_NotEqualTo(swigCPtr, Rotation.getCPtr(rhs));
305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 /// Returns the length of the rotation
312 /// <returns>The length of the rotation</returns>
313 public float Length()
315 float ret = NDalicPINVOKE.Rotation_Length(swigCPtr);
316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 /// Returns the squared length of the rotation
323 /// <returns>The squared length of the rotation</returns>
324 public float LengthSquared()
326 float ret = NDalicPINVOKE.Rotation_LengthSquared(swigCPtr);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 /// Normalizes this to unit length.
334 public void Normalize()
336 NDalicPINVOKE.Rotation_Normalize(swigCPtr);
337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 /// <returns>A normalized version of this rotation</returns>
344 public Rotation Normalized()
346 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Normalized(swigCPtr), true);
347 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
352 /// Conjugates this rotation.
354 public void Conjugate()
356 NDalicPINVOKE.Rotation_Conjugate(swigCPtr);
357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 /// Inverts this rotation.
365 NDalicPINVOKE.Rotation_Invert(swigCPtr);
366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 /// Performs the logarithm of a rotation
372 /// <returns>A rotation representing the logarithm</returns>
373 public Rotation Log()
375 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Log(swigCPtr), true);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 /// Performs an exponent
383 /// <returns>A rotation representing the exponent</returns>
384 public Rotation Exp()
386 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Exp(swigCPtr), true);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 /// Returns the dot product of two rotations.
394 /// <param name="q1">The first rotation</param>
395 /// <param name="q2">The second rotation</param>
396 /// <returns>The dot product of the two rotations</returns>
397 public static float Dot(Rotation q1, Rotation q2)
399 float ret = NDalicPINVOKE.Rotation_Dot(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 /// Linear Interpolation (using a straight line between the two rotations).
407 /// <param name="q1">The start rotation</param>
408 /// <param name="q2">The end rotation</param>
409 /// <param name="t">A progress value between 0 and 1</param>
410 /// <returns>The interpolated rotation</returns>
411 public static Rotation Lerp(Rotation q1, Rotation q2, float t)
413 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Lerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true);
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419 /// Spherical Linear Interpolation (using the shortest arc of a great circle between the two rotations).
421 /// <param name="q1">The start rotation</param>
422 /// <param name="q2">The end rotation</param>
423 /// <param name="progress">A progress value between 0 and 1</param>
424 /// <returns>The interpolated rotation</returns>
425 public static Rotation Slerp(Rotation q1, Rotation q2, float progress)
427 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Slerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), progress), true);
428 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
433 /// This version of Slerp, used by Squad, does not check for theta > 90.
435 /// <param name="q1">The start rotation</param>
436 /// <param name="q2">The end rotation</param>
437 /// <param name="t">A progress value between 0 and 1</param>
438 /// <returns>The interpolated rotation</returns>
439 public static Rotation SlerpNoInvert(Rotation q1, Rotation q2, float t)
441 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SlerpNoInvert(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true);
442 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447 /// Spherical Cubic Interpolation.
449 /// <param name="start">The start rotation</param>
450 /// <param name="end">The end rotation</param>
451 /// <param name="ctrl1">The control rotation for q1</param>
452 /// <param name="ctrl2">The control rotation for q2</param>
453 /// <param name="t">A progress value between 0 and 1</param>
454 /// <returns>The interpolated rotation</returns>
455 public static Rotation Squad(Rotation start, Rotation end, Rotation ctrl1, Rotation ctrl2, float t)
457 Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Squad(Rotation.getCPtr(start), Rotation.getCPtr(end), Rotation.getCPtr(ctrl1), Rotation.getCPtr(ctrl2), t), true);
458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
463 /// Returns the shortest angle between two rotations in Radians.
465 /// <param name="q1">The first rotation</param>
466 /// <param name="q2">The second rotation</param>
467 /// <returns>The angle between the two rotation</returns>
468 public static float AngleBetween(Rotation q1, Rotation q2)
470 float ret = NDalicPINVOKE.Rotation_AngleBetween(Rotation.getCPtr(q1), Rotation.getCPtr(q2));
471 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();