Class

# CMAttitude

The device’s orientation relative to a known frame of reference at a point in time.

## Overview

The `CMAttitude` class offers three different mathematical representations of attitude: a rotation matrix, a quaternion, and Euler angles (roll, pitch, and yaw values). You access `CMAttitude` objects through the attitude property of each `CMDeviceMotion` objects passed to an application. An application starts receiving these device-motion objects as a result of calling the `startDeviceMotionUpdates(using:to:withHandler:)` method, the `startDeviceMotionUpdates(to:withHandler:)` method, the `startDeviceMotionUpdates(using:)` method, or the `startDeviceMotionUpdates()` method of the `CMMotionManager` class.

## Topics

### Getting a Mathematical Representation of Attitude as Euler Angles

`var roll: Double`

The roll of the device, in radians.

`var pitch: Double`

The pitch of the device, in radians.

`var yaw: Double`

The yaw of the device, in radians.

### Getting a Mathematical Representation of Attitude as a Rotation Matrix

`var rotationMatrix: CMRotationMatrix`

Returns a rotation matrix representing the device's attitude.

`struct CMRotationMatrix`

The type of a structure representing a rotation matrix.

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

`var quaternion: CMQuaternion`

Returns a quaternion representing the device's attitude.

`struct CMQuaternion`

The type for a quaternion representing a measurement of attitude.

### Obtaining the Change in Attitude

`func multiply(byInverseOf: CMAttitude)`

Yields the change in attitude given a specific attitude.

## Relationships

### Device Motion

Getting Processed Device-Motion Data

Retrieve data that has already been processed to remove environmental bias, such as the effects of gravity.

`class CMDeviceMotion`

Encapsulated measurements of the attitude, rotation rate, and acceleration of a device.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.