[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 | Vector4 () |
template<typename Other> | |
constexpr | Vector4 (const Vector4< Other > &vector) |
constexpr | Vector4 (const Vector2< Real > &vector, const Real z, const Real w) |
constexpr | Vector4 (const Vector3< Real > &vector, const Real w) |
constexpr | Vector4 (const Real x, const Real y, const Real z, const Real w) |
constexpr Vector4 | abs () const |
Vector4 | ceil () const |
Vector4 | floor () const |
Vector4 | round () const |
constexpr Vector4 | clamp (const Vector4 &min, const Vector4 &max) const |
constexpr Real | length_sqrd () const |
Real | length () const |
Vector4 | clamp_length (const Real min, const Real max) const |
Vector4 | normalize () const |
constexpr Vector4 | lerp (const Vector4 &to, const Real weight) const |
constexpr Vector4 | lerp_clamped (const Vector4 &to, const Real weight) const |
constexpr Real | dot (const Vector4 &other) const |
constexpr Matrix4< Real > | outer (const Vector4 &other) const |
constexpr Vector4 | inverse () const |
constexpr Vector4 | transform (const Transform3< Real > &by) const |
constexpr Vector4 | transform_at (const Vector3< Real > &origin, const Transform3< Real > &by) const |
constexpr Real | max () const |
constexpr Real | abs_max () const |
constexpr Real | min () const |
constexpr Real | abs_min () const |
constexpr uint8_t | max_index () const |
constexpr uint8_t | abs_max_index () const |
constexpr uint8_t | min_index () const |
constexpr uint8_t | abs_min_index () const |
constexpr bool | approx_equal (const Vector4 &other) const |
constexpr bool | approx_zero () const |
constexpr Vector2< Real > | xy () const |
constexpr Vector3< Real > | xyz () const |
const Real * | begin () const |
const Real * | end () const |
Real * | begin () |
Real * | end () |
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 Vector4 &other) const |
constexpr bool | operator!= (const Vector4 &other) const |
constexpr Vector4 | operator+ (const Vector4 &other) const |
constexpr Vector4 & | operator+= (const Vector4 &other) |
constexpr Vector4 | operator- (const Vector4 &other) const |
constexpr Vector4 & | operator-= (const Vector4 &other) |
constexpr Vector4 | operator* (const Vector4 &other) const |
constexpr Vector4 & | operator*= (const Vector4 &other) |
constexpr Vector4 | operator* (const Matrix4< Real > &matrix) const |
constexpr Vector4 | operator* (const Real value) const |
constexpr Vector4 & | operator*= (const Real value) |
constexpr Vector4 | operator/ (const Vector4 &other) const |
constexpr Vector4 & | operator/= (const Vector4 &other) |
constexpr Vector4 | operator/ (const Real value) const |
constexpr Vector4 & | operator/= (const Real value) |
constexpr bool | operator< (const Vector4 &other) const |
constexpr Vector4 | operator+ () const |
constexpr Vector4 | operator- () const |
constexpr | operator bool () const |
Static Public Member Functions | |
static constexpr Vector4 | from_quaternion (const Quaternion< Real > &quaternion) |
static constexpr Vector4 | all (const Real value) |
static constexpr Vector4 | zero () |
static constexpr Vector4 | one () |
static constexpr Vector4 | axis_x () |
static constexpr Vector4 | axis_y () |
static constexpr Vector4 | axis_z () |
static constexpr Vector4 | axis_w () |
Public Attributes | |
Real | x |
Real | y |
Real | z |
Real | w |
Four-dimensional vector.
Real | Floating-point type. |
|
inlineconstexpr |
Initialize all components with zero.
|
inlineexplicitconstexpr |
Cast from another vector type.
Other | Other type. |
vector | Vector to cast from. |
|
inlineconstexpr |
Initialize x and y from two-dimensional vector and z and w values.
vector | Two-dimensional vector. |
z | Z value. |
w | W value. |
|
inlineconstexpr |
Initialize x, y, and z with three-dimensional vector and w value.
vector | Three-dimensional vector. |
w | W value. |
|
inlineconstexpr |
Initialize with components.
x | X value. |
y | Y value. |
z | Z value. |
w | W value. |
|
inlinenodiscardconstexpr |
Component-wise absolute value.
|
inlinenodiscardconstexpr |
Absolute-value maximum component.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Absolute-value minimum component.
|
inlinenodiscardconstexpr |
Index of absolute-value minimum component.
|
inlinestaticconstexpr |
Vector with all components with value.
value | Value. |
|
inlinenodiscardconstexpr |
If approximately equal to another vector.
other | Other vector. |
|
inlinenodiscardconstexpr |
If all components are approximately zero.
|
inlineconstexpr |
Reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Constant reference to component at index.
index | Index. |
|
inlinestaticconstexpr |
Normalized vector that points in the direction of the positive w-axis.
|
inlinestaticconstexpr |
Normalized vector that points in the direction of the positive x-axis.
|
inlinestaticconstexpr |
Normalized vector that points in the direction of the positive y-axis.
|
inlinestaticconstexpr |
Normalized vector that points in the direction of the positive z-axis.
|
inline |
Start iterator.
|
inlinenodiscard |
Start constant iterator.
|
inlinenodiscard |
Component-wise ceiling.
|
inlinenodiscardconstexpr |
Component-wise clamp.
min | Minimum. |
max | Maximum. |
|
inlinenodiscard |
Vector with same direction but length is clamped between minimum and maximum values.
min | Minimum length. |
max | Maximum length. |
|
inlinenodiscardconstexpr |
Vector dot product.
other | Other vector. |
|
inline |
End iterator.
|
inlinenodiscard |
End constant iterator.
|
inlinenodiscard |
Component-wise floor.
|
staticconstexpr |
Vector from quaternion. X, y, and z values are copied directly.
quaternion | Quaternion. |
|
inlinenodiscardconstexpr |
Inverse vector.
|
inlinenodiscard |
Vector length.
|
inlinenodiscardconstexpr |
Squared vector length.
|
inlinenodiscardconstexpr |
Component-wise linear interpolation.
to | Vector to interpolate to. |
weight | Interpolation weight typically from zero to one. |
|
inlinenodiscardconstexpr |
Component-wise linear interpolation with weight clamped between zero and one.
to | Vector to interpolate to. |
weight | Interpolation weight that is clamped between zero and one. |
|
inlinenodiscardconstexpr |
Maximum component.
|
inlinenodiscardconstexpr |
Index of maximum component.
|
inlinenodiscardconstexpr |
Minimum component.
|
inlinenodiscardconstexpr |
Index of minimum component.
|
inlinenodiscard |
Normalize vector length to one.
|
inlinestaticconstexpr |
Vector with all components one.
|
inlineexplicitnodiscardconstexpr |
Evaluates to false if all components are zero, true otherwise.
|
inlinenodiscardconstexpr |
Component-wise inequality.
other | Other vector. |
|
nodiscardconstexpr |
Vector-matrix multiplication.
matrix | 4x4 matrix. |
|
inlinenodiscardconstexpr |
Component-wise multiplication with value.
value | Value. |
|
inlinenodiscardconstexpr |
Component-wise multiplication.
other | Other vector. |
|
inlineconstexpr |
Component-wise multiplication with value.
value | Value. |
|
inlineconstexpr |
Component-wise multiplication.
other | Other vector. |
|
inlinenodiscardconstexpr |
Unary plus. Does nothing but provide symmetry with unary minus.
|
inlinenodiscardconstexpr |
Component-wise addition.
other | Other vector. |
|
inlineconstexpr |
Component-wise addition.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise negation.
|
inlinenodiscardconstexpr |
Component-wise subtraction.
other | Other vector. |
|
inlineconstexpr |
Component-wise subtraction.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise division with value.
value | Value. |
|
inlinenodiscardconstexpr |
Component-wise division.
other | Other vector. |
|
inlineconstexpr |
Component-wise division with value.
value | Value. |
|
inlineconstexpr |
Component-wise division.
other | Other vector. |
|
inlinenodiscardconstexpr |
Lexicographical comparison between components.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise equality.
other | Other vector. |
|
inlineconstexpr |
Reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Constant reference to component at index.
index | Index. |
|
nodiscardconstexpr |
Vector outer product.
other | Other vector. |
|
inlinenodiscard |
Component-wise round.
|
nodiscardconstexpr |
Transform by a three-dimensional transformation matrix about the origin.
by | Transformation matrix to transform by. |
|
nodiscardconstexpr |
Transform by a three-dimensional transformation matrix about an origin.
origin | Origin to transform about. |
by | Transformation matrix to transform by. |
|
inlinenodiscardconstexpr |
Two-dimensional vector from the first two components (x and y) of this vector.
|
inlinenodiscardconstexpr |
Three-dimensional vector from the first three components (x, y, and z) of this vector.
|
inlinestaticconstexpr |
Vector with all components zero.
Real nnm::Vector4< Real >::w |
Real nnm::Vector4< Real >::x |
Real nnm::Vector4< Real >::y |
Real nnm::Vector4< Real >::z |