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

Functions

Conjugate
QuaternionT!T Conjugate()

Returns a conjugated quaternion

Normalize
QuaternionT!T Normalize()

Returns a normalized quaternion

ToEulerAngle
Vector3T!T ToEulerAngle()

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

ToEulerAngle
void ToEulerAngle(ref T roll, ref T pitch, ref 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

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