Computes the inverse of a quaternion.
XMVECTOR XMQuaternionInverse(
XMVECTOR Q
)
Q
Type: XMVECTOR
Quaternion to invert.
Type: XMVECTOR
Returns the inverse of Q.
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 following pseudocode demonstrates the operation of the function:
XMVECTOR Result;
float LengthSq = Q.x * Q.x + Q.y * Q.y + Q.z * Q.z + Q.w * Q.w;
Result.x = -Q.x / LengthSq;
Result.y = -Q.y / LengthSq;
Result.z = -Q.z / LengthSq;
Result.w = Q.w / LengthSq;
return Result;
Header: Declared in directxmath.h.