XMQuaternionRotationMatrix

Computes a rotation quaternion from a rotation matrix.

Syntax

XMVECTOR XMQuaternionRotationMatrix(
         CXMMATRIX M
)  

Parameters

M
Type: CXMMATRIX 

Rotation matrix.

Return value

Type: XMVECTOR 

Returns the rotation quaternion.

Remarks

This function only uses the upper 3x3 portion of the XMMATRIX. Note if the input matrix contains scales, shears, or other non-rotation transformations in the upper 3x3 matrix, then the output of this function is ill-defined.

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.

Requirements

Header: Declared in directxmath.h.