/// <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); }
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); }
/** * @brief Returns the velocity of the body at some position in world space. **/ public TSVector GetPointVelocity(TSVector worldPoint) { TSVector directionPoint = position - tsCollider.Body.TSPosition; return(TSVector.Cross(tsCollider.Body.TSAngularVelocity, directionPoint) + tsCollider.Body.TSLinearVelocity); }
/// <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); }
/** * @brief Returns the velocity of the body at some position in world space. **/ public TSVector2 GetPointVelocity(TSVector2 worldPoint) { TSVector directionPoint = (position - tsCollider.Body.TSPosition).ToTSVector(); return(TSVector.Cross(new TSVector(0, 0, tsCollider.Body.TSAngularVelocity), directionPoint).ToTSVector2() + tsCollider.Body.TSLinearVelocity); }