# Quaternion Structure

.NET Framework 2.0

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

Namespace: Microsoft.WindowsMobile.DirectX
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

## Syntax

```public struct Quaternion
```
```public final class Quaternion extends ValueType
```
```JScript suports the use of structures, but not the declaration of new ones.
```

## Remarks

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.

## Platforms

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

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

## Version Information

#### .NET Compact Framework

Supported in: 2.0

#### Reference

Quaternion Members
Microsoft.WindowsMobile.DirectX Namespace

#### Other Resources

Mobile Direct3D Programming