Quaternion

Quaternion representation

Constructors

this
this(T x, T y, T z, T w)
Undocumented in source.
this
this(T[4] arr)
Undocumented in source.
this
this(Vector!(T, 4) v)
Undocumented in source.
this
this(Vector!(T, 3) v, T neww)
Undocumented in source.

Alias This

vectorof

Members

Aliases

conj
alias conj = conjugate
Undocumented in source.

Functions

computeW
void computeW()

Compute the W component of a unit length quaternion

conjugate
Quaternion!(T) conjugate()

Conjugate A quaternion with the opposite rotation

generator
Vector!(T, 3) generator()

Quaternion as an angular velocity

normalized
Quaternion!(T) normalized()

Normalized version

opBinary
Quaternion!(T) opBinary(Quaternion!(T) q)

Quaternion!(T) + Quaternion!(T)

opBinary
Quaternion!(T) opBinary(Quaternion!(T) q)

Quaternion!(T) - Quaternion!(T)

opBinary
Quaternion!(T) opBinary(Quaternion!(T) q)

Quaternion!(T) * Quaternion!(T)

opBinary
Quaternion!(T) opBinary(T k)

Quaternion!(T) * T

opBinary
Quaternion!(T) opBinary(T k)

Quaternion!(T) / T

opBinary
Quaternion!(T) opBinary(Vector!(T, 3) v)

Quaternion!(T) * Vector!(T,3)

opBinaryRight
Quaternion!(T) opBinaryRight(T k)

T * Quaternion!(T)

opBinaryRight
Vector!(T, 3) opBinaryRight(Vector!(T, 3) v)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Quaternion!(T) opOpAssign(Quaternion!(T) q)

Quaternion!(T) += Quaternion!(T)

opOpAssign
Quaternion!(T) opOpAssign(Quaternion!(T) q)

Quaternion!(T) -= Quaternion!(T)

opOpAssign
Quaternion!(T) opOpAssign(Quaternion!(T) q)

Quaternion!(T) *= Quaternion!(T)

opOpAssign
Quaternion!(T) opOpAssign(T k)

Quaternion!(T) *= T

opOpAssign
Quaternion!(T) opOpAssign(T k)

Quaternion!(T) /= T

opOpAssign
Quaternion!(T) opOpAssign(Vector!(T, 3) v)

Quaternion!(T) *= Vector!(T,3)

rotate
Vector!(T, 3) rotate(Vector!(T, 3) v)

Rotate a point by quaternion

rotationAngle
T rotationAngle()

Return the rotation angle (in radians)

rotationAxis
Vector!(T, 3) rotationAxis()

Return the rotation axis

toEulerAngles
Vector!(T, 3) toEulerAngles()

Setup the Euler angles, given a rotation Quaternion. Returned x,y,z are in radians

toMatrix3x3
Matrix!(T, 3) toMatrix3x3()

Convert to 3x3 matrix

toMatrix4x4
Matrix!(T, 4) toMatrix4x4()

Convert to 4x4 matrix

Static functions

fromEulerAngles
Quaternion!(T) fromEulerAngles(Vector!(T, 3) e)

Setup the quaternion to perform a rotation, given the orientation in XYZ-Euler angles format (in radians)

fromMatrix
Quaternion!(T) fromMatrix(Matrix!(T, 4) m)

Setup the quaternion to perform a rotation, given the angular displacement in matrix form

identity
Quaternion!(T) identity()

Identity quaternion

Variables

vectorof
Vector!(T, 4) vectorof;
Undocumented in source.

Meta