[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 | Transform3 () |
template<typename Other> | |
constexpr | Transform3 (const Transform3< Other > &transform) |
constexpr | Transform3 (const Matrix4< Real > &matrix) |
constexpr Real | trace () const |
constexpr Real | determinant () const |
constexpr Transform3 | unchecked_inverse () const |
constexpr std::optional< Transform3 > | inverse () const |
constexpr bool | valid () const |
constexpr bool | affine () const |
constexpr Basis3< Real > | basis () const |
constexpr Vector3< Real > | translation () const |
constexpr Transform3 | translate (const Vector3< Real > &offset) const |
constexpr Transform3 | translate_local (const Vector3< Real > &offset) const |
Transform3 | rotate_axis_angle (const Vector3< Real > &axis, const Real angle) const |
Transform3 | rotate_axis_angle_local (const Vector3< Real > &axis, const Real angle) const |
constexpr Transform3 | rotate_quaternion (const Quaternion< Real > &quaternion) const |
constexpr Transform3 | rotate_quaternion_local (const Quaternion< Real > &quaternion) const |
constexpr Transform3 | scale (const Vector3< Real > &factor) const |
constexpr Transform3 | scale_local (const Vector3< Real > &factor) const |
constexpr Transform3 | shear_x (const Real factor_y, const Real factor_z) const |
constexpr Transform3 | shear_x_local (const Real factor_y, const Real factor_z) const |
constexpr Transform3 | shear_y (const Real factor_x, const Real factor_z) const |
constexpr Transform3 | shear_y_local (const Real factor_x, const Real factor_z) const |
constexpr Transform3 | shear_z (const Real factor_x, const Real factor_y) const |
constexpr Transform3 | shear_z_local (const Real factor_x, const Real factor_y) const |
constexpr Transform3 | transform (const Transform3 &by) const |
constexpr Transform3 | transform_local (const Transform3 &by) const |
constexpr bool | approx_equal (const Transform3 &other) const |
constexpr const Vector4< Real > & | at (const uint8_t column) const |
constexpr Vector4< Real > & | at (const uint8_t column) |
constexpr const Real & | at (const uint8_t column, const uint8_t row) const |
constexpr Real & | at (const uint8_t column, const uint8_t row) |
constexpr const Vector4< Real > & | operator[] (const uint8_t column) const |
constexpr Vector4< Real > & | operator[] (const uint8_t column) |
constexpr bool | operator== (const Transform3 &other) const |
constexpr bool | operator!= (const Transform3 &other) const |
constexpr bool | operator< (const Transform3 &other) const |
Static Public Member Functions | |
static constexpr Transform3 | from_basis_translation (const Basis3< Real > &basis, const Vector3< Real > &translation) |
static constexpr Transform3 | from_basis (const Basis3< Real > &basis) |
static constexpr Transform3 | from_translation (const Vector3< Real > &translation) |
static Transform3 | from_rotation_axis_angle (const Vector3< Real > &axis, const Real angle) |
static constexpr Transform3 | from_rotation_quaternion (const Quaternion< Real > &quaternion) |
static constexpr Transform3 | from_scale (const Vector3< Real > &factor) |
static constexpr Transform3 | from_shear_x (const Real factor_y, const Real factor_z) |
static constexpr Transform3 | from_shear_y (const Real factor_x, const Real factor_z) |
static constexpr Transform3 | from_shear_z (const Real factor_x, const Real factor_y) |
static Transform3 | from_perspective_left_hand_neg1to1 (const Real fov, const Real aspect_ratio, const Real near_clip, const Real far_clip) |
static Transform3 | from_perspective_left_hand_0to1 (const Real fov, const Real aspect_ratio, const Real near_clip, const Real far_clip) |
static Transform3 | from_perspective_right_hand_neg1to1 (const Real fov, const Real aspect_ratio, const Real near_clip, const Real far_clip) |
static Transform3 | from_perspective_right_hand_0to1 (const Real fov, const Real aspect_ratio, const Real near_clip, const Real far_clip) |
static constexpr Transform3 | from_orthographic_left_hand_neg1to1 (const Real left, const Real right, const Real bottom, const Real top, const Real near_clip, const Real far_clip) |
static constexpr Transform3 | from_orthographic_left_hand_0to1 (const Real left, const Real right, const Real bottom, const Real top, const Real near_clip, const Real far_clip) |
static constexpr Transform3 | from_orthographic_right_hand_neg1to1 (const Real left, const Real right, const Real bottom, const Real top, const Real near_clip, const Real far_clip) |
static constexpr Transform3 | from_orthographic_right_hand_0to1 (const Real left, const Real right, const Real bottom, const Real top, const Real near_clip, const Real far_clip) |
Public Attributes | |
Matrix4< Real > | matrix |
Three-dimensional transformation matrix.
Real | Floating-point type. |
|
inlineconstexpr |
Initialize with identity.
|
inlineexplicitconstexpr |
Cast from other transform.
Other | Other type. |
transform | Other transform. |
|
inlineexplicitconstexpr |
Initialize from a 4x4 matrix. No validation/checks are done.
matrix | Matrix. |
|
inlinenodiscardconstexpr |
Determines if transform is affine. Affine means that the transform preserves parallel lines.
|
inlinenodiscardconstexpr |
Determines if approximately equal to another transform.
other | Other transform. |
|
inlineconstexpr |
Reference to column at index.
column | Index of column. |
|
inlinenodiscardconstexpr |
Constant reference to column at index.
column | Index of column. |
|
inlineconstexpr |
Reference to element at column and row index.
column | Index of column. |
row | Index of row. |
|
inlinenodiscardconstexpr |
Constant reference to element at column and row index.
column | Index of column. |
row | Index of row. |
|
inlinenodiscardconstexpr |
Basis of the transform.
|
inlinenodiscardconstexpr |
Determinant of the matrix.
|
inlinestaticconstexpr |
Transform from a 3D basis and no translation.
basis | 3D Basis. |
|
inlinestaticconstexpr |
Transform from a 3D basis and 3D translation.
basis | 3D basis. |
translation | 3D translation vector. |
|
inlinestaticconstexpr |
Transform with orthographic projection with left-handed coordinate system and normalized from 0 to 1.
left | Left distance. |
right | Right distance. |
bottom | Bottom distance. |
top | Top distance. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestaticconstexpr |
Transform with orthographic projection with left-handed coordinate system and normalized from -1 to 1.
left | Left distance. |
right | Right distance. |
bottom | Bottom distance. |
top | Top distance. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestaticconstexpr |
Transform with orthographic projection with right-handed coordinate system and normalized from 0 to 1.
left | Left distance. |
right | Right distance. |
bottom | Bottom distance. |
top | Top distance. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestaticconstexpr |
Transform with orthographic projection with right-handed coordinate system and normalized from -1 to 1.
left | Left distance. |
right | Right distance. |
bottom | Bottom distance. |
top | Top distance. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestatic |
Transform with perspective projection with left-handed coordinate system and normalized from 0 to 1.
fov | Field-of-view in radians. |
aspect_ratio | Aspect ratio. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestatic |
Transform with perspective projection with left-handed coordinate system and normalized from -1 to 1.
fov | Field-of-view in radians. |
aspect_ratio | Aspect ratio. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestatic |
Transform with perspective projection with right-handed coordinate system and normalized from 0 to 1.
fov | Field-of-view in radians. |
aspect_ratio | Aspect ratio. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestatic |
Transform with perspective projection with right-handed coordinate system and normalized from -1 to 1.
fov | Field-of-view in radians. |
aspect_ratio | Aspect ratio. |
near_clip | Near clipping plane distance. |
far_clip | Far clipping plane distance. |
|
inlinestatic |
Transform rotated about a normalized axis and angle.
axis | Normalized 3D axis vector. |
angle | Angle in radians. |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
Transform scaled by per-axis factor.
factor | Scale factor vector. |
|
inlinestaticconstexpr |
Transform sheared about the x-axis.
factor_y | Y-Axis factor. |
factor_z | Z-Axis factor. |
|
inlinestaticconstexpr |
Transform sheared about the y-axis.
factor_x | X-Axis factor. |
factor_z | Z-Axis factor. |
|
inlinestaticconstexpr |
Transform sheared about the z-axis.
factor_x | X-Axis factor. |
factor_y | Z-Axis factor. |
|
inlinestaticconstexpr |
Transform with a translation.
translation | 3D translation vector. |
|
inlinenodiscardconstexpr |
Inverse of the transform.
|
inlinenodiscardconstexpr |
Element-wise inequality
other | Other transform. |
|
inlinenodiscardconstexpr |
Lexicographical comparison.
other | Other transform. |
|
inlinenodiscardconstexpr |
Element-wise equality.
other | Other transform. |
|
inlineconstexpr |
Reference to column at column index.
column | Index of column. |
|
inlinenodiscardconstexpr |
Constant reference to column at column index.
column | Index of column. |
|
inlinenodiscard |
Rotation about an axis by an angle.
axis | Normalized 3D vector axis. |
angle | Angle in radians. |
|
inlinenodiscard |
Local rotation about an axis by an angle.
axis | Normalized 3D vector axis. |
angle | Angle in radians. |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Per-axis scale by factor.
factor | 3D scale factor vector. |
|
inlinenodiscardconstexpr |
Local per-axis scale by factor.
factor | 3D scale factor vector. |
|
inlinenodiscardconstexpr |
Shear about the x-axis.
factor_y | Y-Axis factor. |
factor_z | Z-Axis factor. |
|
inlinenodiscardconstexpr |
Local shear about the x-axis.
factor_y | Y-Axis factor. |
factor_z | Z-Axis factor. |
|
inlinenodiscardconstexpr |
Shear about the y-axis.
factor_x | X-Axis factor. |
factor_z | Z-Axis factor. |
|
inlinenodiscardconstexpr |
Local shear about the y-axis.
factor_x | X-Axis factor. |
factor_z | Z-Axis factor. |
|
inlinenodiscardconstexpr |
Shear about the z-axis.
factor_x | X-Axis factor. |
factor_y | Z-Axis factor. |
|
inlinenodiscardconstexpr |
Local shear about the z-axis.
factor_x | X-Axis factor. |
factor_y | Z-Axis factor. |
|
inlinenodiscardconstexpr |
Trace which is the sum of the matrix diagonal.
|
inlinenodiscardconstexpr |
Transform by another transform.
by | Other transform. |
|
inlinenodiscardconstexpr |
Local transform by another transform.
by | Other transform. |
|
inlinenodiscardconstexpr |
Translation.
offset | Offset vector. |
|
inlinenodiscardconstexpr |
Local translation.
offset | Offset vector. |
|
inlinenodiscardconstexpr |
Translation vector of the transform.
|
inlinenodiscardconstexpr |
Inverse of the transform without checking if a valid inverse is possible.
|
inlinenodiscardconstexpr |
Determines if transform is valid. Validity is determined based on if the transform's basis is valid.
Matrix4<Real> nnm::Transform3< Real >::matrix |
Matrix of transform