Quaternion
Represents a quaternion, a mathematical concept used to represent rotations in 3D space. Quaternions are a more compact and efficient way to represent rotations compared to Euler angles.
Parameters
The x-component of the quaternion. Default is 0.
The y-component of the quaternion. Default is 0.
The z-component of the quaternion. Default is 0.
The w-component of the quaternion. Default is 0.
Constructors
Functions
Calculates the shortest angle between two quaternions in radians.
Calculates the dot product of this quaternion with another quaternion.
Creates a quaternion from a 4x4 rotation matrix.
Creates a quaternion from a rotation vector and an angle.
Gets the quaternion's components and stores them in the provided array.
Calculates the inverse of the quaternion and stores it in the provided quaternion.
Calculates the inverse of the provided quaternion and stores it in the provided quaternion.
Multiplies this quaternion with another quaternion.
Multiplies two quaternions and stores the result in the provided quaternion.
Normalizes this quaternion.
Normalizes the provided quaternion and stores the result in the provided quaternion.
Rotates a 3D vector in eye position using this quaternion and stores the result in the provided array.
Sets the quaternion's components to match those of the provided quaternion.
Sets the quaternion's components to the provided values.
Performs spherical linear interpolation (SLERP) between two quaternions.
Swaps the rotation direction of the quaternion by negating the w-component.
Convert to glasses quaternion to Yaw, Pitch, Roll in world. Note that glasses coordinates are 'right', 'up', 'back', while the world is defined by 'east', 'north', 'up'.
Converts the quaternion to a 4x4 rotation matrix and stores it in the provided array.
Converts the quaternion to a rotation vector x, y, z, angle.