Class: Quaternion

Quaternion

Quaternion is a class to represent (in our case) rotations.


new Quaternion()

Author:
  • derschmale <http://www.derschmale.com>

Members


norm

Gets the quaternion's norm


normSquared

Gets the quaternion's squared norm

Methods


append()

Post-multiplies another quaternion to this one.


conjugate()

Converts to the conjugate.


copyFrom()

Copies all components from another quaternion


fromAxisAngle()

Initializes as an axis/angle rotation


fromEuler()

Initializes from Euler angles


fromMatrix()

Initializes from a rotation matrix


fromPitchYawRoll()

Initializes from Tait-Bryan angles


invert()

inverts the quaternion.


lerp(a, b, t)

Linearly interpolates two quaternions.

Parameters:
Name Type Description
a Quaternion

The first vector to interpolate from.

b Quaternion

The second vector to interpolate to.

t Number

The interpolation factor.


multiply()

Multiplies two quaternions and stores it in the current.


negate()

Negates all the components. This results in the same net rotation, but with different orientation


normalize()

Normalizes the quaternion.


prepend()

Pre-multiplies another quaternion to this one.


rotate( [target])

Rotates a Float4 point.

Parameters:
Name Type Argument Description
target Float4 <optional>

An optional target object. If not provided, a new object will be created and returned.


set()

Sets all components explicitly


slerp(a, b, t)

Spherical-linearly interpolates two quaternions.

Parameters:
Name Type Description
a Quaternion

The first vector to interpolate from.

b Quaternion

The second vector to interpolate to.

t Number

The interpolation factor.


toEuler()

Stores the rotation as Euler angles in a Float4 object