Quaternion

Quaternion implementation. Holds a rotation + angle in a proper but wild space.

Constructors

this
this(U x)

Construct a Quaternion from a value.

this
this(T qw, T qx, T qy, T qz)

Constructs a Quaternion from coordinates. Warning: order of coordinates is different from storage.

Members

Functions

inverse
void inverse()

Inverses a quaternion in-place.

inversed
Quaternion inversed()
normalize
void normalize()

Normalizes a quaternion.

normalized
Quaternion normalized()
opAssign
Quaternion opAssign(U u)

Assign from another Quaternion.

opAssign
Quaternion opAssign(U u)

Assign from a vector of 4 elements.

opBinary
Quaternion opBinary(U operand)
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
U opCast()

Convert to a 3x3 rotation matrix. TODO: check out why we can't do is(Unqual!U == mat3!T)

opCast
U opCast()

Converts a to a 4x4 rotation matrix.

opEquals
bool opEquals(U other)

Compare two Quaternions.

opEquals
bool opEquals(U other)

Compare Quaternion and other types.

opOpAssign
Quaternion opOpAssign(U q)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Quaternion opOpAssign(U operand)
Undocumented in source. Be warned that the author may not have intended to support it.
toEulerAngles
vec3!T toEulerAngles()

Converts a quaternion to Euler angles. TODO: adds a EulerAngles type.

toString
string toString()

Converts to a pretty string.

Static functions

fromAxis
Quaternion fromAxis(Vector!(T, 3) axis, T angle)

Constructs a Quaternion from axis + angle.

fromEulerAngles
Quaternion fromEulerAngles(T roll, T pitch, T yaw)

Constructs a Quaternion from Euler angles. All paramers given in radians. Roll->X axis, Pitch->Y axis, Yaw->Z axis

identity
Quaternion identity()

Workaround Vector not being constructable through CTFE

Unions

__anonymous
union __anonymous
Undocumented in source.

Meta