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


<static> fromAxisAngle()

Creates a new Quaternion from an axis/angle rotation.


<static> fromEuler()

Creates a new Quaternion from Euler angles.


<static> fromMatrix()

Creates a new Quaternion from a rotation matrix.


<static> fromPitchYawRoll()

Creates a new Quaternion from pitch/yaw/roll Tait Bryan angles.


<static> fromVectors()

Creates a new Quaternion that rotates v1 to v2


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


inverseOf()

Stores the inverse of a given quaternion.


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