quat
Header file: include/quat.h
quat is a quaternion with 4 scalars, a, b, c and d.
\(quat = a + bi + cj + dk\)
Class variables
Type |
Name |
Description |
|---|---|---|
float |
a |
The first element of the quat. |
float |
b |
The second element of the quat. |
float |
c |
The third element of the quat. |
float |
d |
The fourth element of the quat. |
Class functions
Constructors
Name |
Description |
|---|---|
Construct a (0.0, 0.0, 0.0, 0.0) quaternion. |
|
Construct a (_a, _b, _c, _d) quaternion. |
|
Construct a quaternion from a pointer. |
Operators
Name |
Description |
|---|---|
Add a quat to the current quat. |
|
Substract a quat from the current quat. |
|
Multiply the current quat by a quat. |
|
Multiply the current quat by a scalar. |
|
Divide the current quat by a scalar. |
|
nml::quat operator-() |
Return the negative of the current quat. |
Return a reference to a if index is 0, a reference to b if index is 1, a reference to c if index is 2 or a reference to d if index is 3, else, throw an exception. |
|
Return the value of a if index is 0, the value of b if index is 1, the value of c if index is 2 or the value of d if index is 3, else, throw an exception. |
Functions
Name |
Description |
|---|---|
Return the length of the quaternion. |
|
Return a pointer to the quaternion’s elements. |
Static Functions
Name |
Description |
|---|---|
nml::quat nml::quat::identity() |
Return a (1.0, 0.0, 0.0, 0.0) identity quaternion. |
Namespace functions
Operators
Name |
Description |
|---|---|
Return a quat that is the sum between two quat. |
|
Return a quat that is the difference between two quat. |
|
Return a quat that is the product between two quat. |
|
Return a quat that is the product between a quat and a scalar. |
|
Return a quat that is the product between a scalar and a quat. |
|
Return a quat that is the quotient between a quat and a scalar. |
|
Return true if the two quat are identical, else, return false. |
|
Return true if the two quat are different, else, return false. |
Functions
Name |
Description |
|---|---|
Return the conjugate of a quaternion. |
|
Return a quat with the same direction as qua but with length 1. |
|
Return the dot product between two quat. |
|
quat nml::slerp(const nml::quat& a, const nml::quat& b, const float interpolationValue) |
Return the spherical linear interpolation between two quat and an interpolation value. |
Return a quaternion from euler angles in radians. |
|
Return a quaternion from a rotation matrix. |
|
Return a quat as a string under the format “a + bi + cj + dk”. |