XMQuaternionInverse

Computes the inverse of a quaternion.

Syntax

XMVECTOR XMQuaternionInverse(
         XMVECTOR Q
)  

Parameters

Q
Type: XMVECTOR 

Quaternion to invert.

Return value

Type: XMVECTOR 

Returns the inverse of Q.

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 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;  

Requirements

Header: Declared in directxmath.h.