Ejemplo n.º 1
0
        /// <summary>
        /// Computes a quaternion's axis and angle of rotation.
        /// </summary>
        /// <param name="q">Source TGCQuaternion structure. See Remarks.</param>
        /// <param name="axis">A TGCVector3 structure that identifies the quaternion's axis of rotation.</param>
        /// <param name="angle">A float value that identifies the quaternion's angle of rotation, in radians.</param>
        public static void ToAxisAngle(TGCQuaternion q, ref TGCVector3 axis, ref float angle)
        {
            //TODO no deberia depender de Vector3
            Vector3 tempAxis = axis;

            Quaternion.ToAxisAngle(q.ToQuaternion(), ref tempAxis, ref angle);
            axis = new TGCVector3(tempAxis);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds two quaternions.
 /// </summary>
 /// <param name="m1">Source Quaternion.</param>
 /// <param name="m2">Source Quaternion.</param>
 /// <returns>Sum of the two source Quaternion.</returns>
 public static TGCQuaternion Add(TGCQuaternion m1, TGCQuaternion m2)
 {
     return(new TGCQuaternion(Quaternion.Add(m1.ToQuaternion(), m2.ToQuaternion())));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Interpolates between quaternions, using spherical quadrangle interpolation.
 /// </summary>
 /// <param name="q1">Source TGCQuaternion structure.</param>
 /// <param name="a">Source TGCQuaternion structure.</param>
 /// <param name="b">Source TGCQuaternion structure.</param>
 /// <param name="c">Source TGCQuaternion structure.</param>
 /// <param name="t">A float value that indicates how far to interpolate between the quaternions.</param>
 /// <returns></returns>
 public static TGCQuaternion Squad(TGCQuaternion q1, TGCQuaternion a, TGCQuaternion b, TGCQuaternion c, float t)
 {
     return(new TGCQuaternion(Quaternion.Squad(q1.ToQuaternion(), a.ToQuaternion(), b.ToQuaternion(), c.ToQuaternion(), t)));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Subtracts two quaternion instances.
 /// </summary>
 /// <param name="m1">Source Quaternion structure to the left of the subtraction operator.</param>
 /// <param name="m2">Source Quaternion structure to the right of the subtraction operator.</param>
 /// <returns>A Quaternion structure that is the result of the operation.</returns>
 public static TGCQuaternion Subtract(TGCQuaternion m1, TGCQuaternion m2)
 {
     return(new TGCQuaternion(Quaternion.Subtract(m1.ToQuaternion(), m1.ToQuaternion())));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Returns the normal of a quaternion.
 /// </summary>
 /// <param name="q">Source Quaternion.</param>
 /// <returns>A Quaternion that is the normal of the quaternion.</returns>
 public static TGCQuaternion Normalize(TGCQuaternion q)
 {
     return(new TGCQuaternion(Quaternion.Normalize(q.ToQuaternion())));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Interpolates between two quaternions, using spherical linear interpolation.
 /// </summary>
 /// <param name="q1">Source TGCQuaternion structure.</param>
 /// <param name="q2">Source TGCQuaternion structure.</param>
 /// <param name="t">A float value that indicates how far to interpolate between the quaternions.</param>
 /// <returns>A TGCQuaternion structure that is the result of the interpolation.</returns>
 public static TGCQuaternion Slerp(TGCQuaternion q1, TGCQuaternion q2, float t)
 {
     return(new TGCQuaternion(Quaternion.Slerp(q1.ToQuaternion(), q2.ToQuaternion(), t)));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Multiplies two quaternions.
 /// </summary>
 /// <param name="q">Source Quaternion.</param>
 public void Multiply(TGCQuaternion q)
 {
     this.dxQuaternion.Multiply(q.ToQuaternion());
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Multiplies two quaternions.
 /// </summary>
 /// <param name="m1">Source Quaternion.</param>
 /// <param name="m2">Source Quaternion.</param>
 /// <returns>A Quaternion that is the product of two quaternions.</returns>
 public static TGCQuaternion Multiply(TGCQuaternion m1, TGCQuaternion m2)
 {
     return(new TGCQuaternion(Quaternion.Multiply(m1.ToQuaternion(), m2.ToQuaternion())));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Returns the square of a quaternion's length.
 /// </summary>
 /// <param name="v">Source Quaternion.</param>
 /// <returns>A float that represents the quaternion's squared length.</returns>
 public static float LengthSq(TGCQuaternion v)
 {
     return(Quaternion.LengthSq(v.ToQuaternion()));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Calculates the natural logarithm.
 /// </summary>
 /// <param name="q">Source Quaternion.</param>
 /// <returns>A Quaternion that is the natural logarithm of the quaternion passed into the q parameter.</returns>
 public static TGCQuaternion Ln(TGCQuaternion q)
 {
     return(new TGCQuaternion(Quaternion.Ln(q.ToQuaternion())));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Conjugates and re-normalizes a quaternion.
 /// </summary>
 /// <param name="q">Source Quaternion.</param>
 /// <returns>A Quaternion that is the inverse of the quaternion passed into the q parameter.</returns>
 public static TGCQuaternion Invert(TGCQuaternion q)
 {
     return(new TGCQuaternion(Quaternion.Invert(q.ToQuaternion())));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Calculates the exponential.
 /// </summary>
 /// <param name="q">Source Quaternion.</param>
 /// <returns>The Quaternion that is the exponential of the q parameter.</returns>
 public static TGCQuaternion Exp(TGCQuaternion q)
 {
     return(new TGCQuaternion(Quaternion.Exp(q.ToQuaternion())));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Returns the dot product of two quaternions.
 /// </summary>
 /// <param name="v1">Source Quaternion.</param>
 /// <param name="v2">Source Quaternion.</param>
 /// <returns>Dot product of two quaternions.</returns>
 public static float Dot(TGCQuaternion v1, TGCQuaternion v2)
 {
     return(Quaternion.Dot(v1.ToQuaternion(), v2.ToQuaternion()));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Returns the conjugate of a quaternion.
 /// </summary>
 /// <param name="q">Returns the conjugate of a quaternion.</param>
 /// <returns>A Quaternion that is the conjugate of the q parameter.</returns>
 public static TGCQuaternion Conjugate(TGCQuaternion q)
 {
     return(new TGCQuaternion(Quaternion.Conjugate(q.ToQuaternion())));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Returns a quaternion in barycentric coordinates.
 /// </summary>
 /// <param name="q1">Source Quaternion.</param>
 /// <param name="q2">Source Quaternion.</param>
 /// <param name="q3">Source Quaternion.</param>
 /// <param name="f">Weighting factor.</param>
 /// <param name="g">Weighting factor.</param>
 /// <returns>Resulting Quaternion in barycentric coordinates.</returns>
 public static TGCQuaternion BaryCentric(TGCQuaternion q1, TGCQuaternion q2, TGCQuaternion q3, float f, float g)
 {
     return(new TGCQuaternion(Quaternion.BaryCentric(q1.ToQuaternion(), q2.ToQuaternion(), q3.ToQuaternion(), f, g)));
 }