Exemple #1
0
        public static FPQuaternion FromToRotation(FPVector fromVector, FPVector toVector)
        {
            FPVector     w = FPVector.Cross(fromVector, toVector);
            FPQuaternion q = new FPQuaternion(w.x, w.y, w.z, FPVector.Dot(fromVector, toVector));

            q.w += FP.Sqrt(fromVector.sqrMagnitude * toVector.sqrMagnitude);
            q.Normalize();

            return(q);
        }
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <returns>Returns the dot product of both.</returns>
 #region public static FP operator *(JVector value1, JVector value2)
 public static FP operator *(FPVector value1, FPVector value2)
 {
     return(FPVector.Dot(ref value1, ref value2));
 }
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="vector1">The first vector.</param>
 /// <param name="vector2">The second vector.</param>
 /// <returns>Returns the dot product of both vectors.</returns>
 #region public static FP Dot(JVector vector1, JVector vector2)
 public static FP Dot(FPVector vector1, FPVector vector2)
 {
     return(FPVector.Dot(ref vector1, ref vector2));
 }