Quaternion implementation.
Holds a rotation + angle in a proper but wild space.
pure nothrow @nogc this(U)(U x) if (isAssignable!U);
Construct a Quaternion from a value.
pure nothrow @nogc this(T qw, T qx, T qy, T qz);
Constructs a Quaternion from coordinates.
- Warning:
-
order of coordinates is different from storage.
static pure nothrow @nogc Quaternion fromAxis(Vector!(T, 3) axis, T angle);
Constructs a Quaternion from axis + angle.
static pure nothrow @nogc 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
- See Also
- https://www.cs.princeton.edu/~gewang/projects/darth/stuff/quat_faq.html
Converts a quaternion to Euler angles.
- TODO:
-
adds a EulerAngles type.
- Returns
- A vector which contains roll-pitch-yaw as x-y-z.
pure nothrow @nogc ref Quaternion opAssign(U)(U u) if (isQuaternionInstantiation!U && is(U._T : T));
Assign from another Quaternion.
pure nothrow @nogc ref Quaternion opAssign(U)(U u) if (is(U : Vector!(T, 4u)));
Assign from a vector of 4 elements.
Converts to a pretty string.
- Returns
- Normalized quaternion.
Inverses a quaternion in-place.
const pure nothrow @nogc Quaternion inversed();
- Returns
- Inverse of quaternion.
const pure bool opEquals(U)(U other) if (is(U : Quaternion));
const pure nothrow bool opEquals(U)(U other) if (isConvertible!U);
Compare Quaternion and other types.
const pure nothrow @nogc U opCast(U)() if (isMatrixInstantiation!U && is(U._T : _T) && U._R == 3 && U._C == 3);
Convert to a 3x3 rotation matrix.
- TODO:
-
check out why we can't do is(Unqual!U == mat3!T)
const pure nothrow @nogc U opCast(U)() if (isMatrixInstantiation!U && is(U._T : _T) && U._R == 4 && U._C == 4);
Converts a to a 4x4 rotation matrix.
- Known Bugs
- check why we can't do is(Unqual!U == mat4!T)
Linear interpolation, for quaternions.