[−][src]Function directx_math::XMQuaternionMultiply
pub fn XMQuaternionMultiply(Q1: FXMVECTOR, Q2: FXMVECTOR) -> FXMVECTOR
Computes the product of two quaternions.
Parameters
Q1 First quaternion.
Q2 Second quaternion.
Return Value
Returns the product of two quaternions as Q2*Q1.
Remarks
The DirectXMath quaternion functions use an XMVECTOR 4-vector to represent
quaternions, where the X, Y, and Z components are the vector part and
the W component is the scalar part.
The result represents the rotation Q1 followed by the rotation Q2 to be
consistent with XMMatrixMultiply concatenation since this function is
typically used to concatenate quaternions that represent rotations
(i.e. it returns Q2*Q1).
This function computes the equivalent to the following pseduo-code:
XMVECTOR Result;
Result.x = (Q2.w * Q1.x) + (Q2.x * Q1.w) + (Q2.y * Q1.z) - (Q2.z * Q1.y);
Result.y = (Q2.w * Q1.y) - (Q2.x * Q1.z) + (Q2.y * Q1.w) + (Q2.z * Q1.x);
Result.z = (Q2.w * Q1.z) + (Q2.x * Q1.y) - (Q2.y * Q1.x) + (Q2.z * Q1.w);
Result.w = (Q2.w * Q1.w) - (Q2.x * Q1.x) - (Q2.y * Q1.y) - (Q2.z * Q1.z);
return Result;
Reference
https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMQuaternionMultiply