D3DXQuaternionMultiply function (D3dx9math.h)

Note

The D3DX utility library is deprecated. We recommend that you use DirectXMath instead.

Multiplies two quaternions.

Syntax

D3DXQUATERNION* D3DXQuaternionMultiply(
  _Inout_       D3DXQUATERNION *pOut,
  _In_    const D3DXQUATERNION *pQ1,
  _In_    const D3DXQUATERNION *pQ2
);

Parameters

pOut [in, out]

Type: D3DXQUATERNION*

Pointer to the D3DXQUATERNION structure that is the result of the operation.

pQ1 [in]

Type: const D3DXQUATERNION*

Pointer to a source D3DXQUATERNION structure.

pQ2 [in]

Type: const D3DXQUATERNION*

Pointer to a source D3DXQUATERNION structure.

Return value

Type: D3DXQUATERNION*

Pointer to a D3DXQUATERNION structure that is the product of two quaternions.

Remarks

The result represents the rotation Q1 followed by the rotation Q2 (Out = Q2 * Q1). This is done so that D3DXQuaternionMultiply maintain the same semantics as D3DXMatrixMultiply because unit quaternions can be considered as another way to represent rotation matrices.

Transformations are concatenated in the same order for both the D3DXQuaternionMultiply and D3DXMatrixMultiply functions. For example, assuming mX and mY represent the same rotations as qX and qY, both m and q will represent the same rotations.

D3DXMatrixMultiply(&m, &mX, &mY);
D3DXQuaternionMultiply(&q, &qX, &qY);

The multiplication of quaternions is not commutative.

The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXQuaternionMultiply function can be used as a parameter for another function.

Use D3DXQuaternionNormalize for any quaternion input that is not already normalized.

Requirements

Requirement Value
Header
D3dx9math.h
Library
D3dx9.lib

See also

Math Functions

D3DXMatrixMultiply