---
title: CMQuaternion
framework: coremotion
role: symbol
role_heading: Structure
path: coremotion/cmquaternion
---

# CMQuaternion

The type for a quaternion representing a measurement of attitude.

## Declaration

```swift
struct CMQuaternion
```

## Overview

Overview A quaternion offers a way to parameterize attitude. If q is an instance of CMQuaternion, mathematically it represents the following unit quaternion: q.x*i + q.y*j + q.z*k + q.w. A unit quaternion represents a rotation of theta radians about the unit vector {x,y,z}, and {q.x, q.y, q.z, q.w} satisfies the following: q.x = x * sin(theta / 2) q.y = y * sin(theta / 2) q.z = z * sin(theta / 2) q.w = cos(theta / 2)

## Topics

### Initializing the Quaternion

- [init()](coremotion/cmquaternion/init().md)
- [init(x:y:z:w:)](coremotion/cmquaternion/init(x:y:z:w:).md)

### Getting the Quaternion Values

- [w](coremotion/cmquaternion/w.md)
- [x](coremotion/cmquaternion/x.md)
- [y](coremotion/cmquaternion/y.md)
- [z](coremotion/cmquaternion/z.md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Sendable](swift/sendable.md)

## See Also

### Getting a Mathematical Representation of Attitude as a Quaternion

- [quaternion](coremotion/cmattitude/quaternion.md)
