Quaternion

Quaternion over a FloatPoint type,

Constructors

this
this(T i, T j, T k, T w)

Build a new Quaternion from a set of initial values

this
this(T[] xs)

Build a new Quaternion from a array If no there values for j, and k, will be set to 0. w is set to 1

this
this(Vector!(T, 3) vec)

Build a new Quaternion from a 3D Vector w will be set to 1

this
this(Vector!(T, 4) vec)

Build a new Quaternion from a 4D Vector

this
this(Vector!(T, 3) v, U angle)

Creates a Quaternion from a 3d Vector and angle

this
this(U roll, U pitch, U yaw)

Creates a new Quaternion from Euler angles Params : roll = Rotation around X axis in radians (aka bank) pitch = Rotation around Y axis in radians (aka attitude) yaw = Rotation around Z axis in radians (aka heading)

Members

Functions

approxEqual
bool approxEqual(Quaternion rhs, T maxRelDiff, T maxAbsDiff)

Approximated equality with controlable precision

conj
Quaternion conj()

Obtain conjugate of a Quaternion

normalize
void normalize()

Normalize this Quaternion

opBinary
Quaternion opBinary(Quaternion rhs)

Define binary operator + and -

opBinary
Quaternion opBinary(T rhs)

Define Scalar multiplication

opBinary
Quaternion opBinary(Quaternion rhs)

Defines Hamilton product for Quaternions

opCast
Tout opCast()

Casting for convert between Quaternions

opCast
Tout opCast()

Casting to rotation Matrix

opEquals
bool opEquals(Quaternion rhs)

Define Equality

opIndex
T opIndex(size_t i)

Returns i coord of this vector

opIndexAssign
void opIndexAssign(T c, size_t i)

Assigns a value to a coord

opUnary
Quaternion opUnary()

Define unary operators + and -

rotate
V rotate(V v)

Apply a 3d rotation Quaternion over a 3d/4d Vector

toAxisAngle
Vector!(T, 3) toAxisAngle(T angle)

Calc the Axis and angle of rotation of this Quaternion

toEuler
Vector!(T, 3) toEuler()

Returns a Vector with euler's angles

toString
string toString()

Returns a string representation of this Quaternion

Properties

isUnit
bool isUnit [@property getter]

It's a unitary Quaternion (length == 1)

length
T length [@property getter]

Returns the actual length of this quaternion

sq_length
T sq_length [@property getter]

Returns the actual squared length of this quaternion

Static variables

dim
enum size_t dim;

Quaternion Dimension

Unions

__anonymous
union __anonymous
Undocumented in source.

Meta