Function directx_math::XMQuaternionInverse[][src]

pub fn XMQuaternionInverse(Q: FXMVECTOR) -> FXMVECTOR

Computes the inverse of a quaternion.

Parameters

Q Quaternion to invert.

Return value

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;

Reference

https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMQuaternionInverse