# Math.Quaternion

Provides a quaternion object for representing rotations.

The loose form of a Quaternion, `loose<Quaternion>` is of the form `(x, y, z, w)`

Inherits Math.Vector<4>

## Methods

#### classpublic Quaternion:NewFromAngles(`Vector3 angles`)

Returns `Quaternion`

#### objectpublic Quaternion:InitFromAngles(`Vector3 angles`)

Returns `void`

• required `angles`: A Vector3 containing the angles to convert.

Converts a Vector3 containing Euler angles into a Quaternion.

#### classpublic Quaternion:NewFromLooseAngles(`number x, number y, number z`)

Returns `Quaternion`

#### objectpublic Quaternion:InitFromLooseAngles(`number x, number y, number z`)

Returns `void`

• required `x`: The x component of the angles.
• required `y`: The y component of the angles.
• required `z`: The z component of the angles.

Converts a loose<Vector3> containing Euler angles into a Quaternion.

#### classpublic Quaternion:NewLooseFromAngles(`Vector3 angles`)

Returns `loose<Quaternion>`

• required `angles`: A Vector3 containing the angles to convert.

Converts a Vector3 containing Euler angles into a loose Quaternion.

#### classpublic Quaternion:NewLooseFromLooseAngles(`number x, number y, number z`)

Returns `loose<Quaternion>`

• required `x`: The x component of the angles.
• required `y`: The y component of the angles.
• required `z`: The z component of the angles.

Converts a loose<Vector3> containing Euler angles into a loose Quaternion.

#### classpublic Quaternion:LooseMultiplyLooseLoose(`loose<Quaternion> a, loose<Quaternion> b`)

Returns `loose<Quaternion>`

• required `a`: The left operand on the multiply.
• required `b`: The right operand on the multiply.

Multiplies two loose quaternions together and returns the result in loose form.

#### objectpublicQuaternion:LooseMultiplyLoose(`loose<Quaternion> quaternion`)

Returns `loose<Quaternion>`

• required `quaternion`: The quaternion to multiply with.

Multiplies the quaternion with a loose Quaternion, yielding a loose<Quaternion>.

#### objectpublicQuaternion:Slerp(`Quaternion other, number t, [Quaternion out]`)

Returns `self`

• required `other`: The Quaternion to slerp with.
• required `t`: A number, normally on [0, 1], that determines the mixing ratio of the quaternions.
• optional `out`: Where to put the resulting slerped Quaternion.

Performs a Quaternion slerp (spherical interpolation).

#### objectpublic Quaternion:Conjugate(`[Quaternion out]`)

Returns `Quaternion`

• optional `out`: Where to put the resulting data.

Returns the conjugate of the Quaternion, `(-i, -j, -k, w)`.

#### objectpublic Quaternion:Conjugate!()

Returns `Quaternion`

#### objectpublic Quaternion:ConjugateInPlace()

Returns `Quaternion`

Conjugates the Quaternion in-place.

#### objectpublic Quaternion:LooseConjugate()

Returns `loose<Quaternion>`

Returns the conjugate of the quaternion in loose form.

#### objectpublic Quaternion:Multiply(`Quaternion other, [Quaternion out]`)

Returns `Quaternion`

• required `other`: The quaternion to multiply with.
• optional `out`: Where to put the resulting data.

Multiplies the quaternion with another Quaternion.

#### objectpublic Quaternion:Multiply!(`Quaternion other`)

Returns `self`

#### objectpublic Quaternion:MultiplyInPlace(`Quaternion other`)

Returns `self`

• required `other`: The quaternion to multiply with.

Multiplies the quaternion with another Quaternion and puts the result in the first Quaternion.

#### objectpublic Quaternion:MultiplyLoose(`loose<Quaternion> quaternion, [Quaternion out]`)

Returns `Quaternion`

• required `quaternion`: The loose quaternion to multiply with.
• optional `out`: Where to put the resulting data.

Multiplies the quaternion with a loose Quaternion.

#### objectpublic Quaternion:MultiplyLoose!(`loose<Quaternion> quaternion`)

Returns `Quaternion`

• required `quaternion`: The loose quaternion to multiply with.

Multiplies this quaternion with another loose Quaternion in-place.

#### objectpublic Quaternion:Slerp!(`Quaternion other, number t`)

Returns `self`

#### objectpublicQuaternion:SlerpInPlace(`Quaternion other, number t`)

Returns `self`

• required `other`: The Quaternion to slerp with.
• required `t`: A number, normally on [0, 1], that determines the mixing ratio of the quaternions.

Performs a Quaternion slerp (spherical interpolation) in place.

#### objectpublic Quaternion:TransformVector(`Vector3 vec, [Vector3 out]`)

Returns `self`

• required `vec`: The vector to rotate.
• optional `out`: Where to put the resulting data.

Transforms a vector by rotating it.

[none]