### Members

#### (static, constant) equals

Returns whether or not the quaternions have approximately the same elements in the same position.

#### (static, constant) exactEquals

Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)

#### (static, constant) length

Calculates the length of a quat

#### (static, constant) rotationTo

Sets a quaternion to represent the shortest rotation from one
vector to another.
Both vectors are assumed to be unit length.

#### (static, constant) setAxes

Sets the specified quaternion with values corresponding to the given
axes. Each axis is a vec3 and is expected to be unit length and
perpendicular to all other specified axes.

#### (static, constant) sqlerp

Performs a spherical linear interpolation with two control points

### Methods

#### (static) add(out, a, b) → {quat}

Adds two quat's

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | the first operand |

`b` |
ReadonlyQuat | the second operand |

##### Returns:

out

- Type
- quat

#### (static) calculateW(out, a) → {quat}

Calculates the W component of a quat from the X, Y, and Z components.
Assumes that quaternion is 1 unit in length.
Any existing W component will be ignored.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quat to calculate W component of |

##### Returns:

out

- Type
- quat

#### (static) clone(a) → {quat}

Creates a new quat initialized with values from an existing quaternion

##### Parameters:

Name | Type | Description |
---|---|---|

`a` |
ReadonlyQuat | quaternion to clone |

##### Returns:

a new quaternion

- Type
- quat

#### (static) conjugate(out, a) → {quat}

Calculates the conjugate of a quat
If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quat to calculate conjugate of |

##### Returns:

out

- Type
- quat

#### (static) copy(out, a) → {quat}

Copy the values from one quat to another

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | the source quaternion |

##### Returns:

out

- Type
- quat

#### (static) create() → {quat}

Creates a new identity quat

##### Returns:

a new quaternion

- Type
- quat

#### (static) dot(a, b) → {Number}

Calculates the dot product of two quat's

##### Parameters:

Name | Type | Description |
---|---|---|

`a` |
ReadonlyQuat | the first operand |

`b` |
ReadonlyQuat | the second operand |

##### Returns:

dot product of a and b

- Type
- Number

#### (static) exp(out, a) → {quat}

Calculate the exponential of a unit quaternion.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quat to calculate the exponential of |

##### Returns:

out

- Type
- quat

#### (static) fromEuler(out, Angle, Angle, Angle) → {quat}

Creates a quaternion from the given euler angle x, y, z.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`Angle` |
x | to rotate around X axis in degrees. |

`Angle` |
y | to rotate around Y axis in degrees. |

`Angle` |
z | to rotate around Z axis in degrees. |

##### Returns:

out

- Type
- quat

#### (static) fromMat3(out, m) → {quat}

Creates a quaternion from the given 3x3 rotation matrix.
NOTE: The resultant quaternion is not normalized, so you should be sure
to renormalize the quaternion yourself where necessary.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`m` |
ReadonlyMat3 | rotation matrix |

##### Returns:

out

- Type
- quat

#### (static) fromValues(x, y, z, w) → {quat}

Creates a new quat initialized with the given values

##### Parameters:

Name | Type | Description |
---|---|---|

`x` |
Number | X component |

`y` |
Number | Y component |

`z` |
Number | Z component |

`w` |
Number | W component |

##### Returns:

a new quaternion

- Type
- quat

#### (static) getAngle(a, b) → {Number}

Gets the angular distance between two unit quaternions

##### Parameters:

Name | Type | Description |
---|---|---|

`a` |
ReadonlyQuat | Origin unit quaternion |

`b` |
ReadonlyQuat | Destination unit quaternion |

##### Returns:

Angle, in radians, between the two quaternions

- Type
- Number

#### (static) getAxisAngle(out_axis, q) → {Number}

Gets the rotation axis and angle for a given
quaternion. If a quaternion is created with
setAxisAngle, this method will return the same
values as providied in the original parameter list
OR functionally equivalent values.
Example: The quaternion formed by axis [0, 0, 1] and
angle -90 is the same as the quaternion formed by
[0, 0, 1] and 270. This method favors the latter.

##### Parameters:

Name | Type | Description |
---|---|---|

`out_axis` |
vec3 | Vector receiving the axis of rotation |

`q` |
ReadonlyQuat | Quaternion to be decomposed |

##### Returns:

Angle, in radians, of the rotation

- Type
- Number

#### (static) identity(out) → {quat}

Set a quat to the identity quaternion

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

##### Returns:

out

- Type
- quat

#### (static) invert(out, a) → {quat}

Calculates the inverse of a quat

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quat to calculate inverse of |

##### Returns:

out

- Type
- quat

#### (static) len()

Alias for quat.length

#### (static) lerp(out, a, b, t) → {quat}

Performs a linear interpolation between two quat's

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | the first operand |

`b` |
ReadonlyQuat | the second operand |

`t` |
Number | interpolation amount, in the range [0-1], between the two inputs |

##### Returns:

out

- Type
- quat

#### (static) ln(out, a) → {quat}

Calculate the natural logarithm of a unit quaternion.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quat to calculate the exponential of |

##### Returns:

out

- Type
- quat

#### (static) mul()

Alias for quat.multiply

#### (static) multiply(out, a, b) → {quat}

Multiplies two quat's

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | the first operand |

`b` |
ReadonlyQuat | the second operand |

##### Returns:

out

- Type
- quat

#### (static) normalize(out, a) → {quat}

Normalize a quat

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quaternion to normalize |

##### Returns:

out

- Type
- quat

#### (static) pow(out, a, b) → {quat}

Calculate the scalar power of a unit quaternion.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | quat to calculate the exponential of |

`b` |
Number | amount to scale the quaternion by |

##### Returns:

out

- Type
- quat

#### (static) random(out) → {quat}

Generates a random unit quaternion

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

##### Returns:

out

- Type
- quat

#### (static) rotateX(out, a, rad) → {quat}

Rotates a quaternion by the given angle about the X axis

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | quat receiving operation result |

`a` |
ReadonlyQuat | quat to rotate |

`rad` |
number | angle (in radians) to rotate |

##### Returns:

out

- Type
- quat

#### (static) rotateY(out, a, rad) → {quat}

Rotates a quaternion by the given angle about the Y axis

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | quat receiving operation result |

`a` |
ReadonlyQuat | quat to rotate |

`rad` |
number | angle (in radians) to rotate |

##### Returns:

out

- Type
- quat

#### (static) rotateZ(out, a, rad) → {quat}

Rotates a quaternion by the given angle about the Z axis

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | quat receiving operation result |

`a` |
ReadonlyQuat | quat to rotate |

`rad` |
number | angle (in radians) to rotate |

##### Returns:

out

- Type
- quat

#### (static) scale(out, a, b) → {quat}

Scales a quat by a scalar number

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving vector |

`a` |
ReadonlyQuat | the vector to scale |

`b` |
Number | amount to scale the vector by |

##### Returns:

out

- Type
- quat

#### (static) set(out, x, y, z, w) → {quat}

Set the components of a quat to the given values

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`x` |
Number | X component |

`y` |
Number | Y component |

`z` |
Number | Z component |

`w` |
Number | W component |

##### Returns:

out

- Type
- quat

#### (static) setAxisAngle(out, axis, rad) → {quat}

Sets a quat from the given angle and rotation axis,
then returns it.

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`axis` |
ReadonlyVec3 | the axis around which to rotate |

`rad` |
Number | the angle in radians |

##### Returns:

out

- Type
- quat

#### (static) slerp(out, a, b, t) → {quat}

Performs a spherical linear interpolation between two quat

##### Parameters:

Name | Type | Description |
---|---|---|

`out` |
quat | the receiving quaternion |

`a` |
ReadonlyQuat | the first operand |

`b` |
ReadonlyQuat | the second operand |

`t` |
Number | interpolation amount, in the range [0-1], between the two inputs |

##### Returns:

out

- Type
- quat

#### (static) sqrLen()

Alias for quat.squaredLength

#### (static) squaredLength(a) → {Number}

Calculates the squared length of a quat

##### Parameters:

Name | Type | Description |
---|---|---|

`a` |
ReadonlyQuat | vector to calculate squared length of |

##### Returns:

squared length of a

- Type
- Number

#### (static) str(a) → {String}

Returns a string representation of a quatenion

##### Parameters:

Name | Type | Description |
---|---|---|

`a` |
ReadonlyQuat | vector to represent as a string |

##### Returns:

string representation of the vector

- Type
- String