Struct Quaternion

Quaternion representation

struct Quaternion(T) ;

Methods

NameDescription
computeW () Compute the W component of a unit length quaternion
conjugate () Conjugate A quaternion with the opposite rotation
fromEulerAngles (e) Setup the quaternion to perform a rotation, given the orientation in Euler angles pitch, yaw, roll (in radians)
fromMatrix (m) Setup the quaternion to perform a rotation, given the angular displacement in matrix form
identity () Identity quaternion
normalized () Normalized version
opBinary (q) Quaternion!(T) + Quaternion!(T)
opBinary (q) Quaternion!(T) - Quaternion!(T)
opBinary (q) Quaternion!(T) * Quaternion!(T)
opBinary (k) Quaternion!(T) * T
opBinary (k) Quaternion!(T) / T
opBinary (v) Quaternion!(T) * Vector!(T,3)
opBinaryRight (k) T * Quaternion!(T)
opOpAssign (q) Quaternion!(T) += Quaternion!(T)
opOpAssign (q) Quaternion!(T) -= Quaternion!(T)
opOpAssign (q) Quaternion!(T) *= Quaternion!(T)
opOpAssign (k) Quaternion!(T) *= T
opOpAssign (k) Quaternion!(T) /= T
opOpAssign (v) Quaternion!(T) *= Vector!(T,3)
rotate (v) Rotate a point by quaternion
rotationAngle () Return the rotation angle (in radians)
rotationAxis () Return the rotation axis
toEulerAngles () Setup the Euler angles (pitch, yaw, roll), given a rotation Quaternion. Returned x, y, z are in radians
toMatrix3x3 () Convert to 3x3 matrix
toMatrix4x4 () Convert to 4x4 matrix