This documentation is archived and is not being maintained.

Quaternion Structure

Describes a four-dimensional vector (x, y, z, w).

Namespace:  Microsoft.WindowsMobile.DirectX
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)

public struct Quaternion

Quaternions extend the concept of rotation in three dimensions to rotation in four dimensions. You can use quaternions to rotate an object about the (x, y, z) vector by an angle theta, where w = cos(theta/2). Quaternion operations are computationally more efficient than 4 × 4 matrix multiplications used for transformations and rotations. A quaternion also represents the most efficient rotation to interpolate between two orientations of an object.

Quaternions add a fourth element to the [x, y, z] values that define a vector, resulting in arbitrary 4-D vectors. However, the following formulas illustrate 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 counterclockwise (CCW) rotation around 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)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Compact Framework

Supported in: 3.5, 2.0