sbylib.math.quaternion

Undocumented in source.

Members

Aliases

quat
alias quat = Quaternion!float
Undocumented in source.

Functions

approxEqual
bool approxEqual(Quaternion!(T) a, Quaternion!(T) b, T eps)

Returns true if the distance between the given two point is less than eps.

length
T length(Quaternion!T q)

Returns length of a quaternion.

lengthSq
T lengthSq(Quaternion!T q)

Returns length of a quaternion.

normalize
Quaternion!T normalize(Quaternion!T q)

Returns a quaternion whose length 1 from target quaternion.

rotate
Vector!(T, 3) rotate(Quaternion!(T) q, Vector!(T, 3) vec)

Rotate a vector by a quaternion.

safeNormalize
Quaternion!(T) safeNormalize(Quaternion!(T) q)

Returns a quaternion whose length 1 from target vector. When the length is 0, returns zero quaternion.

slerp
Quaternion!(T) slerp(Quaternion!(T) q1, Quaternion!(T) q2, T t)

Interpolate two quaternions spherically.

toMatrix3
Matrix!(T, 3, 3) toMatrix3(Quaternion!T q)

Converts a quaternion into matrix 3x3.

toMatrix4
Matrix!(T, 4, 4) toMatrix4(Quaternion!T q)

Converts a quaternion into matrix 4x4.

Structs

Quaternion
struct Quaternion(T)

Quaternion type

Meta