[nnm] No Nonsense Math 0.5.0
A No-Nonsense, C++ 17, single-header-only Math library geared towards graphics programming.
|
Classes | |
class | Basis2 |
class | Basis3 |
class | Matrix2 |
class | Matrix3 |
class | Matrix4 |
class | Quaternion |
class | Transform2 |
class | Transform3 |
class | Vector2 |
class | Vector2i |
class | Vector3 |
class | Vector3i |
class | Vector4 |
Typedefs | |
using | Vector2f = Vector2<float> |
using | Vector2d = Vector2<double> |
using | Vector2ii = Vector2i<int> |
using | Vector2i8 = Vector2i<int8_t> |
using | Vector2i16 = Vector2i<int16_t> |
using | Vector2i32 = Vector2i<int32_t> |
using | Vector2i64 = Vector2i<int64_t> |
using | Vector2iu = Vector2i<unsigned int> |
using | Vector2u8 = Vector2i<uint8_t> |
using | Vector2u16 = Vector2i<uint16_t> |
using | Vector2u32 = Vector2i<uint32_t> |
using | Vector2u64 = Vector2i<uint64_t> |
using | Vector3f = Vector3<float> |
using | Vector3d = Vector3<double> |
using | Vector3ii = Vector3i<int> |
using | Vector3i8 = Vector3i<int8_t> |
using | Vector3i16 = Vector3i<int16_t> |
using | Vector3i32 = Vector3i<int32_t> |
using | Vector3i64 = Vector3i<int64_t> |
using | Vector3iu = Vector3i<unsigned int> |
using | Vector3u8 = Vector3i<uint8_t> |
using | Vector3u16 = Vector3i<uint16_t> |
using | Vector3u32 = Vector3i<uint32_t> |
using | Vector3u64 = Vector3i<uint64_t> |
using | Vector4f = Vector4<float> |
using | Vector4d = Vector4<double> |
using | QuaternionF = Quaternion<float> |
using | QuaternionD = Quaternion<double> |
using | Matrix2f = Matrix2<float> |
using | Matrix2d = Matrix2<double> |
using | Basis2f = Basis2<float> |
using | Basis2d = Basis2<double> |
using | Matrix3f = Matrix3<float> |
using | Matrix3d = Matrix3<double> |
using | Transform2f = Transform2<float> |
using | Transform2d = Transform2<double> |
using | Basis3f = Basis3<float> |
using | Basis3d = Basis3<double> |
using | Matrix4f = Matrix4<float> |
using | Matrix4d = Matrix4<double> |
using | Transform3f = Transform3<float> |
using | Transform3d = Transform3<double> |
Functions | |
template<typename Real> | |
constexpr Real | pi () |
template<typename Real> | |
constexpr Real | epsilon () |
template<typename Num> | |
constexpr Num | sign (const Num value) |
template<typename Num> | |
constexpr Num | abs (const Num value) |
template<typename Num> | |
constexpr Num | max (const Num a, const Num b) |
template<typename Num, typename... Rest> | |
constexpr Num | max (const Num first, const Rest... rest) |
template<typename Real> | |
constexpr bool | approx_zero (const Real value) |
template<typename Real> | |
constexpr bool | approx_equal (const Real a, const Real b) |
template<typename Real> | |
constexpr bool | approx_less (const Real a, const Real b) |
template<typename Real> | |
constexpr bool | approx_greater (const Real a, const Real b) |
template<typename Real> | |
constexpr bool | approx_less_equal (const Real a, const Real b) |
template<typename Real> | |
constexpr bool | approx_greater_equal (const Real a, const Real b) |
template<typename Real> | |
constexpr bool | approx_less_zero (const Real value) |
template<typename Real> | |
constexpr bool | approx_greater_zero (const Real value) |
template<typename Real> | |
constexpr bool | approx_less_equal_zero (const Real value) |
template<typename Real> | |
constexpr bool | approx_greater_equal_zero (const Real value) |
template<typename Real> | |
Real | ceil (const Real value) |
template<typename Num> | |
constexpr Num | clamp (const Num value, const Num min, const Num max) |
template<typename Real> | |
Real | sqrt (const Real value) |
template<typename Real> | |
Real | pow (const Real base, const Real power) |
template<typename Num> | |
constexpr Num | sqrd (const Num value) |
template<typename Real> | |
Real | modf (const Real dividend, const Real divisor) |
template<typename Int> | |
constexpr Int | mod (const Int dividend, const Int divisor) |
template<typename Real> | |
Real | remf (const Real dividend, const Real divisor) |
template<typename Int> | |
constexpr Int | rem (const Int dividend, const Int divisor) |
template<typename Real> | |
Real | normalize_angle (const Real angle) |
template<typename Real> | |
bool | angle_in_range (const Real angle, const Real from, const Real to) |
template<typename Real> | |
Real | floor (const Real value) |
template<typename Real> | |
constexpr Real | lerp (const Real from, const Real to, const Real weight) |
template<typename Real> | |
constexpr Real | lerp_clamped (const Real from, const Real to, const Real weight) |
template<typename Real> | |
Real | sin (const Real value) |
template<typename Real> | |
Real | cos (const Real value) |
template<typename Real> | |
Real | tan (const Real value) |
template<typename Real> | |
Real | round (const Real value) |
template<typename Real> | |
Real | atan (const Real value) |
template<typename Real> | |
Real | atan2 (const Real y, const Real x) |
template<typename Real> | |
constexpr Real | radians (const Real degrees) |
template<typename Real> | |
constexpr Real | degrees (const Real radians) |
template<typename Real> | |
Real | asin (const Real value) |
template<typename Real> | |
Real | acos (const Real value) |
template<typename Num> | |
constexpr Num | min (const Num a, const Num b) |
template<typename Num, typename... Rest> | |
constexpr Num | min (const Num first, const Rest... rest) |
template<typename Real> | |
Real | log2 (const Real value) |
template<typename Real> | |
Vector2< Real > constexpr | operator* (const Real value, const Vector2< Real > &vector) |
template<typename Real> | |
Vector2< Real > constexpr | operator/ (const Real value, const Vector2< Real > &vector) |
template<typename Int> | |
constexpr Vector2i< Int > | operator* (const Int value, const Vector2i< Int > &vector) |
template<typename Int> | |
constexpr Vector2i< Int > | operator/ (const Int value, const Vector2i< Int > &vector) |
template<typename Int> | |
constexpr Vector2i< Int > | operator% (const Int value, const Vector2i< Int > &vector) |
template<typename Real> | |
constexpr Vector3< Real > | operator* (const Real value, const Vector3< Real > &vector) |
template<typename Real> | |
constexpr Vector3< Real > | operator/ (const Real value, const Vector3< Real > &vector) |
template<typename Int> | |
constexpr Vector3i< Int > | operator* (const Int value, const Vector3i< Int > &vector) |
template<typename Int> | |
constexpr Vector3i< Int > | operator/ (const Int value, const Vector3i< Int > &vector) |
template<typename Int> | |
constexpr Vector3i< Int > | operator% (const Int value, const Vector3i< Int > &vector) |
template<typename Real> | |
constexpr Vector4< Real > | operator* (const Real value, const Vector4< Real > &vector) |
template<typename Real> | |
constexpr Vector4< Real > | operator/ (const Real value, const Vector4< Real > &vector) |
template<typename Real> | |
constexpr Matrix2< Real > | operator* (const Real value, const Matrix2< Real > &matrix) |
template<typename Real> | |
constexpr Matrix2< Real > | operator/ (const Real value, const Matrix2< Real > &matrix) |
template<typename Real> | |
constexpr Matrix3< Real > | operator* (const Real value, const Matrix3< Real > &matrix) |
template<typename Real> | |
constexpr Matrix3< Real > | operator/ (const Real value, const Matrix3< Real > &matrix) |
template<typename Real> | |
constexpr Matrix4< Real > | operator* (const Real value, const Matrix4< Real > &matrix) |
template<typename Real> | |
constexpr Matrix4< Real > | operator/ (const Real value, const Matrix4< Real > &matrix) |
using nnm::Basis2d = Basis2<double> |
using nnm::Basis2f = Basis2<float> |
using nnm::Basis3d = Basis3<double> |
using nnm::Basis3f = Basis3<float> |
using nnm::Matrix2d = Matrix2<double> |
using nnm::Matrix2f = Matrix2<float> |
using nnm::Matrix3d = Matrix3<double> |
using nnm::Matrix3f = Matrix3<float> |
using nnm::Matrix4d = Matrix4<double> |
using nnm::Matrix4f = Matrix4<float> |
using nnm::QuaternionD = Quaternion<double> |
using nnm::QuaternionF = Quaternion<float> |
using nnm::Transform2d = Transform2<double> |
using nnm::Transform2f = Transform2<float> |
using nnm::Transform3d = Transform3<double> |
using nnm::Transform3f = Transform3<float> |
using nnm::Vector2d = Vector2<double> |
using nnm::Vector2f = Vector2<float> |
using nnm::Vector2i16 = Vector2i<int16_t> |
using nnm::Vector2i32 = Vector2i<int32_t> |
using nnm::Vector2i64 = Vector2i<int64_t> |
using nnm::Vector2i8 = Vector2i<int8_t> |
using nnm::Vector2ii = Vector2i<int> |
using nnm::Vector2iu = Vector2i<unsigned int> |
using nnm::Vector2u16 = Vector2i<uint16_t> |
using nnm::Vector2u32 = Vector2i<uint32_t> |
using nnm::Vector2u64 = Vector2i<uint64_t> |
using nnm::Vector2u8 = Vector2i<uint8_t> |
using nnm::Vector3d = Vector3<double> |
using nnm::Vector3f = Vector3<float> |
using nnm::Vector3i16 = Vector3i<int16_t> |
using nnm::Vector3i32 = Vector3i<int32_t> |
using nnm::Vector3i64 = Vector3i<int64_t> |
using nnm::Vector3i8 = Vector3i<int8_t> |
using nnm::Vector3ii = Vector3i<int> |
using nnm::Vector3iu = Vector3i<unsigned int> |
using nnm::Vector3u16 = Vector3i<uint16_t> |
using nnm::Vector3u32 = Vector3i<uint32_t> |
using nnm::Vector3u64 = Vector3i<uint64_t> |
using nnm::Vector3u8 = Vector3i<uint8_t> |
using nnm::Vector4d = Vector4<double> |
using nnm::Vector4f = Vector4<float> |
|
constexpr |
Absolute value which is the number's distance from zero.
Num | Numeric type |
value | Value to take the absolute value of. |
Real nnm::acos | ( | const Real | value | ) |
Mathematical inverse cosine.
Real | Floating-point value. |
value | Value to take the inverse cosine of. |
bool nnm::angle_in_range | ( | const Real | angle, |
const Real | from, | ||
const Real | to ) |
Determines if an angle in radians is within a range taking into account wrap-around.
Real | Floating-point type. |
angle | Angle to test in radians. |
from | First angle in radians. |
to | Second angle in radians |
|
constexpr |
Determines if two values are approximately equal based on the epsilon value.
Real | Floating-point type. |
a | First value. |
b | Second value. |
|
constexpr |
Determine if the first value is approximately greater-than but not equal to the second value.
Real | Floating-point type. |
a | First value. |
b | Second value. |
|
constexpr |
Determine if the first value is approximately greater-than or equal to the second value.
Real | Floating-point type. |
a | First value. |
b | Second value. |
|
constexpr |
Determine if a value is approximately greater-than or equal to zero.
Real | Floating-point type. |
value | Value. |
|
constexpr |
Determine if a value is approximately greater-than but not equal to zero.
Real | Floating-point type. |
value | Value. |
|
constexpr |
Determine if the first value is approximately less-than but not equal to the second value.
Real | Floating-point type. |
a | First value. |
b | Second value. |
|
constexpr |
Determine if the first value is approximately greater-than or equal to the second value.
Real | Floating-point type. |
a | First value. |
b | Second value. |
|
constexpr |
Determine if a value is approximately less-than or equal to zero.
Real | Floating-point type. |
value | Value. |
|
constexpr |
Determine if a value is approximately less-than but not equal to zero.
Real | Floating-point type. |
value | Value. |
|
constexpr |
Determines if a value is approximately zero based on the epsilon value.
Real | Floating-point type. |
value | Value to test. |
Real nnm::asin | ( | const Real | value | ) |
Mathematical inverse sine.
Real | Floating-point value. |
value | Value to take inverse sine of. |
Real nnm::atan | ( | const Real | value | ) |
Mathematical inverse tangent.
Real | Floating-point value. |
value | Value to take inverse tangent of. |
Real nnm::atan2 | ( | const Real | y, |
const Real | x ) |
Mathematical inverse tangent that takes into account all four-quadrants.
Real | Floating-point value. |
y | Y value. |
x | X value. |
Real nnm::ceil | ( | const Real | value | ) |
The least integer value greater than a value.
Real | Floating-point type. |
value | Value to take the ceiling of. |
|
constexpr |
Restricts a value between a minimum and maximum range.
Num | Numeric type. |
value | Value to clamp. |
min | Minimum allowed value. |
max | Maximum allowed value. |
Real nnm::cos | ( | const Real | value | ) |
Mathematical cosine.
Real | Floating-point value. |
value | Value to take the cosine of in radians. |
|
constexpr |
Converts angle in radians to degrees.
Real | Floating-point value. |
radians | Angle in radians. |
|
constexpr |
Epsilon value is the upper bound on approximation errors.
Real | Floating-point type. |
Real nnm::floor | ( | const Real | value | ) |
The greatest integer value less or equal to a value.
Real | Floating-point type. |
value | Value to take the floor of. |
|
constexpr |
Linear interpolation between two values based on a weight value.
Real | Floating-point value. |
from | Value to interpolate from. |
to | Value to interpolate to. |
weight | Value that indicates interpolation between the two values normally between 0 and 1. |
|
constexpr |
Linear interpolation between two values based on a weight value that is clamped between 0 and 1.
Real | Floating-point value. |
from | Value to interpolate from. |
to | Value to interpolate to. |
weight | Value that indicates interpolation between the two values that is clamped between 0 and 1. |
Real nnm::log2 | ( | const Real | value | ) |
Binary logarithm of a value which is the power to which the number 2 must be raised to obtain the value.
Real | Floating-point value. |
value | Value to take logarithm of. |
|
constexpr |
The maximum between two values.
Num | Numeric type. |
a | First value. |
b | Second value. |
|
constexpr |
The maximum between values.
Num | Numeric type. |
Rest | Numeric types. |
first | First value. |
rest | Rest of the values. |
|
constexpr |
The minimum value between two values.
Num | Numeric type. |
a | First value. |
b | Second value. |
|
constexpr |
The minimum between values.
Num | Numeric type. |
Rest | Numeric types. |
first | First value. |
rest | Rest of the values. |
|
constexpr |
Integer mathematical modulus where the result is always positive.
Int | Integer type. |
dividend | Dividend. |
divisor | Divisor. |
Real nnm::modf | ( | const Real | dividend, |
const Real | divisor ) |
Floating-point mathematical modulus where the result is always positive.
Real | Floating-point type. |
dividend | Dividend. |
divisor | Divisor. |
Real nnm::normalize_angle | ( | const Real | angle | ) |
Normalizes an angle in radians between -pi and pi.
Real | Floating-point type. |
angle | Angle to normalize in radians. |
|
constexpr |
Component-wise remainder with value.
Int | Integer type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise remainder with value.
Int | Integer type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise multiplication with value.
Int | Integer type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise multiplication with value.
Int | Integer type. |
value | Value. |
vector | Vector. |
|
constexpr |
Element-wise multiplication with value.
Real | Floating-point type. |
value | Value. |
matrix | Matrix. |
|
constexpr |
Element-wise multiplication with value.
Real | Floating-point type. |
value | Value. |
matrix | Matrix. |
|
constexpr |
Scalar-matrix multiplication.
Real | Floating-point type. |
value | Value. |
matrix | Matrix. |
|
constexpr |
Scalar-vector multiplication.
Real | Floating-point type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise multiplication with value.
Real | Floating-point type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise multiplication with value.
Real | Floating-point type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise division with value.
Int | Integer type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise division with value.
Int | Integer type. |
value | Value. |
vector | Vector. |
|
constexpr |
Element-wise division with value.
Real | Floating-point type. |
value | Value. |
matrix | Matrix. |
|
constexpr |
Element-wise division with value.
Real | Floating-point type. |
value | Value. |
matrix | Matrix. |
|
constexpr |
Element-wise division by value.
Real | Floating-point type. |
value | Value. |
matrix | Matrix. |
|
constexpr |
Scalar-vector division.
Real | Floating-point type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise division with value.
Real | Floating-point type. |
value | Value. |
vector | Vector. |
|
constexpr |
Component-wise division with value.
Real | Floating-point type. |
value | Value. |
vector | Vector. |
|
constexpr |
Mathematical pi.
Real | Floating-point type. |
Real nnm::pow | ( | const Real | base, |
const Real | power ) |
Exponential operation between two values.
Real | Floating-point type. |
base | Base value. |
power | Power value. |
|
constexpr |
Converts angle in degrees to radians.
Real | Floating-point value. |
degrees | Angle in degrees. |
|
constexpr |
Remainder of the division between two integer values.
Int | Integer type. |
dividend | Dividend. |
divisor | Divisor. |
Real nnm::remf | ( | const Real | dividend, |
const Real | divisor ) |
Remainder of the division between two floating-point values.
Real | Floating-point type |
dividend | Dividend. |
divisor | Divisor. |
Real nnm::round | ( | const Real | value | ) |
Rounds a value to the nearest integer value.
Real | Floating-point value. |
value | Value to round. |
|
constexpr |
One multiplied by the sign of a value.
Num | Numeric type. |
value | Value to get the sign of. |
Real nnm::sin | ( | const Real | value | ) |
Mathematical sine of a value
Real | Floating-point type. |
value | Value to take the sine of in radians. |
|
constexpr |
Square of a value.
Num | Numeric type. |
value | Value to square. |
Real nnm::sqrt | ( | const Real | value | ) |
Square-root of a value.
Real | Floating-point type. |
value | Value to square-root. |
Real nnm::tan | ( | const Real | value | ) |
Mathematical tangent.
Real | Floating-point value. |
value | Value to take the tangent of in radians. |