Esempio n. 1
0
        /// <summary>
        /// The cross product of two vectors.
        /// </summary>
        /// <param name="vector1">The first vector.</param>
        /// <param name="vector2">The second vector.</param>
        /// <returns>The cross product of both vectors.</returns>
        #region public static JVector Cross(JVector vector1, JVector vector2)
        public static TSVector Cross(TSVector vector1, TSVector vector2)
        {
            TSVector result;

            TSVector.Cross(ref vector1, ref vector2, out result);
            return(result);
        }
Esempio n. 2
0
        public static TSQuaternion FromToRotation(TSVector fromVector, TSVector toVector)
        {
            TSVector     w = TSVector.Cross(fromVector, toVector);
            TSQuaternion q = new TSQuaternion(w.x, w.y, w.z, TSVector.Dot(fromVector, toVector));

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

            return(q);
        }
Esempio n. 3
0
        /// <summary>
        /// Calculates the cross product of two vectors.
        /// </summary>
        /// <param name="value1">The first vector.</param>
        /// <param name="value2">The second vector.</param>
        /// <returns>Returns the cross product of both.</returns>
        #region public static JVector operator %(JVector value1, JVector value2)
        public static TSVector operator %(TSVector value1, TSVector value2)
        {
            TSVector result; TSVector.Cross(ref value1, ref value2, out result);

            return(result);
        }