QuaternionT

A quaternion is a way of representing a rotation in three dimensions by storing a rotation and an angle. It properly forms a topological 3-sphere, which allows it to avoid the gimbal lock that plagues the more human-readable euler angle. Read more here: https://euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/geometric/orthogonal

Constructors

this
this(Vector4T!T vec)

Constructs a quaternion from a vector

this
this(QuaternionT!T quat)

Constructs a quaternion from another quaternion

this
this(Vector3T!T axis, T theta)

Constructs a quaternion from an axis and an angle theta

Members

Aliases

ToString
alias ToString = toString
Undocumented in source.
Type
alias Type = T
Undocumented in source.

Functions

Conjugate
QuaternionT!T Conjugate()

Returns a conjugated quaternion

Normalize
QuaternionT!T Normalize()

Returns a normalized quaternion

Scale
QuaternionT!T Scale(T scale)
Undocumented in source. Be warned that the author may not have intended to support it.
ToEulerAngle
Vector3T!T ToEulerAngle()

Returns the euler angle equivalent of this quaternion, in the form of <roll, pitch, yaw>

ToEulerAngle
void ToEulerAngle(T roll, T pitch, T yaw)

Sets euler angle as member parameters, equivalent of this quaternion

opBinary
QuaternionT!T opBinary(U rhs)

quaternion * quaternion

opBinary
QuaternionT!T opBinary(U rhs)

quaternion + quaternion

opOpAssign
void opOpAssign(U rhs)

quaternion *= quaternion

opOpAssign
void opOpAssign(U rhs)

quaternion += quaternion

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

opDispatch
auto opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
U opDispatch [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

Identity
QuaternionT!T Identity()

Constructs identity of a quaternion

ToQuaternion
QuaternionT!T ToQuaternion(T pitch, T roll, T yaw)

Constructs a quaternion from euler angle

ToQuaternion
QuaternionT!T ToQuaternion(Vector3T!T vec)

Constructs a quaternion from euler angle vector

Variables

data
Vector4T!T data;

Holds rotation (xyz) and angle (w)

Meta