Options
All
• Public
• Public/Protected
• All

# Class Quaternion

A Quaternion for 3D rotations.

• Quaternion

## Constructors

### constructor

• new Quaternion(__namedParameters?: { w?: number; x?: number; y?: number; z?: number }): Quaternion

w: number

x: number

y: number

z: number

## Methods

### getAngle

• getAngle(): number

### getAxis

• #### Returns Point3D

normalized axis of shortest positive rotation

### getAzimuth

• getAzimuth(): number
• #### Returns number

Azimuthal angle of rotation in degrees, also known as the "yaw about 'up'"

### getElevation

• getElevation(): number
• #### Returns number

Elevation angle of rotation in degrees, also known as the "pitch from horizontal plane"

### getEulerAngles

• getEulerAngles(): { pitchDegrees: number; rollDegrees: number; yawDegrees: number }
• #### Returns { pitchDegrees: number; rollDegrees: number; yawDegrees: number }

Euler angle decomposition object: {yaw:, pitch:, roll:} where: yawDegrees = degrees rotation about 'up' axis pitchDegrees = degrees rotation about yawed 'right' axis rollDegrees = degrees rotation about yawed and pitched 'forward' axis

### getPitch

• getPitch(): number
• #### Returns number

Pitch angle of rotation in degrees, also known as the "elevation"

### getYaw

• getYaw(): number
• #### Returns number

Yaw angle of rotation in degrees, also known as the "azimuth"

### normalize

• normalize(): void
• Normalize this Quaternion to have unitary length.

### rotateVector

#### Returns Point3D

the rotated vector

### Static dot

#### Returns number

the dot product of two Quaternions

### Static fromAngleAxis

• #### Parameters

• ##### axis: Point3D

axis of rotation (does not need to be unitary)

#### Returns Quaternion

Quaternion representing a rotation of angle about axis.

### Static fromEulerAngles

• fromEulerAngles(__namedParameters?: { pitchDegrees?: number; rollDegrees?: number; yawDegrees?: number }): Quaternion
• #### Parameters

• ##### Optional pitchDegrees?: number

angle in degrees rotation about local-right

• ##### Optional rollDegrees?: number

angle in degrees rotation about local-forward

• ##### Optional yawDegrees?: number

angle in degrees rotation about local-up

#### Returns Quaternion

Quaternion representing a rotation of yaw, pitch, roll about successive local axes: up, right, forward

### Static multiply

• #### Parameters

• ##### a: Quaternion

quaternion on the left

• ##### b: Quaternion

quaternion on the right

#### Returns Quaternion

Product of two quaternions: a * b