BEPUutilities.Toolbox.DifferentiateQuaternion C# (CSharp) 메소드

DifferentiateQuaternion() 공개 정적인 메소드

Finds the change in the rotation state quaternion provided the local inertia tensor and angular velocity.
public static DifferentiateQuaternion ( Quaternion &orientation, Matrix3x3 &localInertiaTensorInverse, System.Vector3 &angularMomentum, Quaternion &orientationChange ) : void
orientation Quaternion Orienatation of the object.
localInertiaTensorInverse Matrix3x3 Local-space inertia tensor of the object being updated.
angularMomentum System.Vector3 Angular momentum of the object.
orientationChange Quaternion Change in quaternion.
리턴 void
        public static void DifferentiateQuaternion(ref Quaternion orientation, ref Matrix3x3 localInertiaTensorInverse, ref Vector3 angularMomentum, out Quaternion orientationChange)
        {
            Quaternion normalizedOrientation;
            Quaternion.Normalize(ref orientation, out normalizedOrientation);
            Matrix3x3 tempRotMat;
            Matrix3x3.CreateFromQuaternion(ref normalizedOrientation, out tempRotMat);
            Matrix3x3 tempInertiaTensorInverse;
            Matrix3x3.MultiplyTransposed(ref tempRotMat, ref localInertiaTensorInverse, out tempInertiaTensorInverse);
            Matrix3x3.Multiply(ref tempInertiaTensorInverse, ref tempRotMat, out tempInertiaTensorInverse);
            Vector3 halfspin;
            Matrix3x3.Transform(ref angularMomentum, ref tempInertiaTensorInverse, out halfspin);
            Vector3.Multiply(ref halfspin, .5f, out halfspin);
            var halfspinQuaternion = new Quaternion(halfspin.X, halfspin.Y, halfspin.Z, 0);
            Quaternion.Multiply(ref halfspinQuaternion, ref normalizedOrientation, out orientationChange);
        }