DirectX SDK

D3DXQuaternionMultiply

The D3DXQuaternionMultiply function multiplies two quaternions.

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

Parameters

pOut
A pointer to the D3DXQUATERNION structure that is the result of the operation.
pQ1
A pointer to a source D3DXQUATERNION structure.
pQ2
A pointer to a source D3DXQUATERNION structure.

Return Values

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

Remarks

The result represents the rotation Q2 followed by the rotation Q1 (Out = Q2 * Q1). Note that the output is actually Q2*Q1 (not Q1*Q2). This is done so D3DXQuaternionMultiply will maintain the same semantics as D3DXMatrixMultiply, since 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.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dxmath.h.
  Library: Use d3dx.lib.

See Also

D3DXMatrixMultiply