Ejemplo n.º 1
0
        /// <summary>
        /// Return a Vector rotated around the Quaternion
        /// </summary>
        /// <param name="q1">
        /// Quaternion
        /// </param>
        /// <param name="v2">
        /// Vector
        /// </param>
        /// <returns>
        /// </returns>
        public static IVector3 RotateVector3(IQuaternion q1, IVector3 v2)
        {
            Quaternion QuatVect = new Quaternion(v2.x, v2.y, v2.z, 0);
            Quaternion QuatNorm = (Quaternion)q1.Normalize();
            Quaternion Result   = Hamilton(Hamilton(QuatNorm, QuatVect), QuatNorm.Conjugate());

            return(new Vector3(Result.x, Result.y, Result.z));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Return a Vector rotated around the Quaternion
 /// </summary>
 /// <param name="q1">
 /// Quaternion
 /// </param>
 /// <param name="v2">
 /// Vector
 /// </param>
 /// <returns>
 /// </returns>
 public static IVector3 RotateVector3(IQuaternion q1, IVector3 v2)
 {
     Quaternion QuatVect = new Quaternion(v2.x, v2.y, v2.z, 0);
     Quaternion QuatNorm = (Quaternion)q1.Normalize();
     Quaternion Result = Hamilton(Hamilton(QuatNorm, QuatVect), QuatNorm.Conjugate());
     return new Vector3(Result.x, Result.y, Result.z);
 }