# API Docs for: 0.9.16
Show:

# Quaternion Class

## Methods

(
• `a`
• `b`
)

Calculates the dot product of two quat's

#### Parameters:

• `a` Quat

the first operand

• `b` Quat

the second operand

#### Returns:

Number:

dot product of a and b

(
• `a`
)
Quat

Creates a new quat initialized with values from an existing quaternion

#### Parameters:

• `a` Quat

quaternion to clone

#### Returns:

Quat:

a new quaternion

(
• `out`
• `a`
)
Quat

Copy the values from one quat to another

#### Parameters:

• `out` Quat

the receiving quaternion

• `a` Quat

the source quaternion

#### Returns:

Quat:

out

(
• `out`
• `x`
• `y`
• `z`
• `w`
)
Quat

Set the components of a quat to the given values

#### Parameters:

• `out` Quat

the receiving quaternion

• `x` Number

X component

• `y` Number

Y component

• `z` Number

Z component

• `w` Number

W component

#### Returns:

Quat:

out

(
• `out`
• `a`
• `b`
)
Quat

#### Parameters:

• `out` Quat

the receiving quaternion

• `a` Quat

the first operand

• `b` Quat

the second operand

#### Returns:

Quat:

out

()

(
• `out`
• `a`
• `b`
)
Quat

Scales a quat by a scalar number

#### Parameters:

• `out` Quat

the receiving vector

• `a` Quat

the vector to scale

• `b` Number

amount to scale the vector by

#### Returns:

Quat:

out

(
• `x`
• `y`
• `z`
• `w`
)
Quat

Creates a new quat initialized with the given values

#### Parameters:

• `x` Number

X component

• `y` Number

Y component

• `z` Number

Z component

• `w` Number

W component

#### Returns:

Quat:

a new quaternion

(
• `out`
• `a`
• `b`
• `t`
)
Quat

Performs a linear interpolation between two quat's

#### Parameters:

• `out` Quat

the receiving quaternion

• `a` Quat

the first operand

• `b` Quat

the second operand

• `t` Number

interpolation amount between the two inputs

#### Returns:

Quat:

out

(
• `a`
)

Calculates the length of a quat

#### Parameters:

• `a` Quat

vector to calculate length of

#### Returns:

Number:

length of a

()

(
• `a`
)

Calculates the squared length of a quat

#### Parameters:

• `a` Quat

vector to calculate squared length of

#### Returns:

Number:

squared length of a

()

(
• `out`
• `a`
)
Quat

Normalize a quat

#### Parameters:

• `out` Quat

the receiving quaternion

• `a` Quat

quaternion to normalize

#### Returns:

Quat:

out

(
• `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:

• `out` Quat

the receiving quaternion

• `m` Mat3

rotation matrix

Quat:

out