[nnm] No Nonsense Math 0.5.0
A No-Nonsense, C++ 17, single-header-only Math library geared towards graphics programming.
|
#include <nnm.hpp>
Public Member Functions | |
constexpr | Quaternion () |
template<typename Other> | |
constexpr | Quaternion (const Quaternion< Other > &quaternion) |
constexpr | Quaternion (const Vector4< Real > &vector) |
constexpr | Quaternion (const Real x, const Real y, const Real z, const Real w) |
Quaternion | normalize () const |
Vector3< Real > | axis_to (const Quaternion &to) const |
Real | angle_to (const Quaternion &to) const |
Vector3< Real > | axis () const |
Real | angle () const |
constexpr Quaternion | inverse () const |
constexpr Real | length_sqrd () const |
Real | length () const |
Quaternion | slerp (const Quaternion &to, const Real weight) const |
Quaternion | rotate_axis_angle (const Vector3< Real > &axis, const Real angle) const |
constexpr Quaternion | rotate_quaternion (const Quaternion &by) const |
constexpr bool | approx_equal (const Quaternion &other) const |
constexpr const Real & | at (const uint8_t index) const |
constexpr Real & | at (const uint8_t index) |
constexpr const Real & | operator[] (const uint8_t index) const |
constexpr Real & | operator[] (const uint8_t index) |
constexpr bool | operator== (const Quaternion &other) const |
constexpr bool | operator!= (const Quaternion &other) const |
constexpr Quaternion | operator* (const Quaternion &other) const |
constexpr Quaternion & | operator*= (const Quaternion &other) |
constexpr bool | operator< (const Quaternion &other) const |
constexpr | operator bool () const |
Static Public Member Functions | |
static constexpr Quaternion | identity () |
static Quaternion | from_axis_angle (const Vector3< Real > &axis, const Real angle) |
static Quaternion | from_vector_to_vector (const Vector3< Real > &from, const Vector3< Real > &to) |
Public Attributes | |
Real | x |
Real | y |
Real | z |
Real | w |
Quaternion which is a four-component vector that represents rotations in three-dimensional space.
Real | Floating-point value. |
|
inlineconstexpr |
Initialize with quaternion identity.
|
inlineexplicitconstexpr |
Cast from another quaternion type.
Other | Other type. |
quaternion | Quaternion to cast from. |
|
inlineexplicitconstexpr |
Initialize from a four-dimensional vector. No normalization is done.
vector | Vector. |
|
inlineconstexpr |
Initialize with components. No normalization is done.
x | X value. |
y | Y value. |
z | Z value. |
w | W value. |
|
inlinenodiscard |
The angle of rotation of the quaternion in radians.
|
inlinenodiscard |
Angle of rotation, in radians, between this quaternion and another quaternion.
to | Quaternion to. |
|
inlinenodiscardconstexpr |
Component-wise equality.
other | Other quaternion. |
|
inlineconstexpr |
Reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Constant reference to component at index.
index | Index. |
|
inlinenodiscard |
The axis of rotation of the quaternion.
|
inlinenodiscard |
The normalized axis of rotation between this quaternion and another quaternion.
to | Quaternion to. |
|
inlinestaticnodiscard |
Quaternion from a normalized axis and angle in radians.
axis | Normalized axis. |
angle | Angle in radians. |
|
inlinestaticnodiscard |
Quaternion that represents the rotation required to align one vector in the direction of another vector.
from | Vector from. |
to | Vector to. |
|
inlinestaticnodiscardconstexpr |
Quaternion identity which is x, y, and z being zero and w being one.
|
inlinenodiscardconstexpr |
Quaternion inverse.
|
inlinenodiscard |
Length of quaternion.
|
inlinenodiscardconstexpr |
Squared length of quaternion.
|
inlinenodiscard |
Normalize quaternion.
|
inlineexplicitnodiscardconstexpr |
Evaluates to false if all components are zero, true otherwise.
|
inlinenodiscardconstexpr |
Component-wise inequality.
other | Other quaternion. |
|
inlinenodiscardconstexpr |
|
inlineconstexpr |
Quaternion multiplication.
other | Other quaternion. |
|
inlinenodiscardconstexpr |
Lexicographical comparison between components.
other | Other quaternion. |
|
inlinenodiscardconstexpr |
Component-wise equality.
other | Other quaternion. |
|
inlinenodiscardconstexpr |
Reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Constant reference to component at index.
index | Index. |
|
inlinenodiscard |
Rotate about a normalized axis and angle in radians.
axis | Normalized axis. |
angle | Angle in radians. |
|
inlinenodiscardconstexpr |
|
inlinenodiscard |
Spherical linear interpolation from one quaternion to another.
to | Quaternion to interpolate to. |
weight | Interpolate weight typically from zero to one. |
Real nnm::Quaternion< Real >::w |
Real nnm::Quaternion< Real >::x |
Real nnm::Quaternion< Real >::y |
Real nnm::Quaternion< Real >::z |