Platform SDK: DirectX

D3DXQUATERNION

The D3DXQUATERNION structure describes a quaternion.

typedef struct D3DXQUATERNION {
  float x, y, z, w;
} D3DXQUATERNION;

Members

x
The x-component.
y
The y-component.
z
The z-component.
w
The w-component.

Remarks

Quaternions add a fourth element to the [x, y, z] values that define a vector, resulting in arbitrary 4-D vectors. However, the following illustrates how each element of a unit quaternion relates to an axis-angle rotation (where q represents a unit quaternion (x, y, z, w), axis is normalized, and theta is the desired CCW rotation about the axis):

q.x = sin(theta/2) * axis.x
q.y = sin(theta/2) * axis.y
q.z = sin(theta/2) * axis.z
q.w = cos(theta/2)

C++ programmers can take advantage of operator overloading and type casting. The C++ implementation of the D3DXQUATERNION structure implements overloaded constructors and overloaded assignment, unary and binary (including equality) operators. For more information, see C++ Specific Features.

Requirements

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

See Also

D3DXPlaneDot, D3DXPlaneDotCoord, D3DXPlaneDotNormal, D3DXPlaneIntersectLine, D3DXPlaneFromPointNormal, D3DXPlaneFromPoints, D3DXPlaneTransform