# quat

## quat

Source:

### Members

#### #(static) rotationTo

Source:

Sets a quaternion to represent the shortest rotation from one vector to another.

Both vectors are assumed to be unit length.

#### #(static) setAxes

Source:

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.

### Methods

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

Source:

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

the first operand

`b` quat

the second operand

out

Type
quat

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

Source:

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` quat

quat to calculate W component of

out

Type
quat

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

Source:

Creates a new quat initialized with values from an existing quaternion

##### Parameters:
Name Type Description
`a` quat

quaternion to clone

a new quaternion

Type
quat

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

Source:

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` quat

quat to calculate conjugate of

out

Type
quat

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

Source:

Copy the values from one quat to another

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

the source quaternion

out

Type
quat

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

Source:

Creates a new identity quat

a new quaternion

Type
quat

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

Source:

Calculates the dot product of two quat's

##### Parameters:
Name Type Description
`a` quat

the first operand

`b` quat

the second operand

##### Returns:

dot product of a and b

Type
Number

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

Source:

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` mat3

rotation matrix

out

Type
quat

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

Source:

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

a new quaternion

Type
quat

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

Source:

Set a quat to the identity quaternion

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

out

Type
quat

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

Source:

Calculates the inverse of a quat

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

quat to calculate inverse of

out

Type
quat

#### #(static) len()

Source:

Alias for quat.length

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

Source:

Calculates the length of a quat

##### Parameters:
Name Type Description
`a` quat

vector to calculate length of

length of a

Type
Number

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

Source:

Performs a linear interpolation between two quat's

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

the first operand

`b` quat

the second operand

`t` Number

interpolation amount between the two inputs

out

Type
quat

#### #(static) mul()

Source:

Alias for quat.multiply

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

Source:

Multiplies two quat's

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

the first operand

`b` quat

the second operand

out

Type
quat

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

Source:

Normalize a quat

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

quaternion to normalize

out

Type
quat

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

Source:

Rotates a quaternion by the given angle about the X axis

##### Parameters:
Name Type Description
`out` quat

quat receiving operation result

`a` quat

quat to rotate

`rad` number

out

Type
quat

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

Source:

Rotates a quaternion by the given angle about the Y axis

##### Parameters:
Name Type Description
`out` quat

quat receiving operation result

`a` quat

quat to rotate

`rad` number

out

Type
quat

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

Source:

Rotates a quaternion by the given angle about the Z axis

##### Parameters:
Name Type Description
`out` quat

quat receiving operation result

`a` quat

quat to rotate

`rad` number

out

Type
quat

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

Source:

Scales a quat by a scalar number

##### Parameters:
Name Type Description
`out` quat

the receiving vector

`a` quat

the vector to scale

`b` Number

amount to scale the vector by

out

Type
quat

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

Source:

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

out

Type
quat

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

Source:

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

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`axis` vec3

the axis around which to rotate

`rad` Number

out

Type
quat

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

Source:

Performs a spherical linear interpolation between two quat

##### Parameters:
Name Type Description
`out` quat

the receiving quaternion

`a` quat

the first operand

`b` quat

the second operand

`t` Number

interpolation amount between the two inputs

out

Type
quat

#### #(static) sqrLen()

Source:

Alias for quat.squaredLength

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

Source:

Calculates the squared length of a quat

##### Parameters:
Name Type Description
`a` quat

vector to calculate squared length of

##### Returns:

squared length of a

Type
Number