|
Not Enough Math
Lightweight zero-dependency C++ math library
|
Namespaces | |
| namespace | accurate |
| namespace | color |
| namespace | ease |
| namespace | error |
| namespace | experimental |
| namespace | fast |
| namespace | intr |
Classes | |
| struct | is_subset_of |
| struct | mat |
| struct | quat_t |
| struct | safe_t |
| struct | sincos |
| struct | storage |
| struct | storage< _T, 2 > |
| struct | storage< _T, 3 > |
| struct | storage< _T, 4 > |
| struct | unsafe_t |
| struct | vec |
Concepts | |
| concept | scalar_type |
| concept | CanBeNaN |
| concept | CanBeNaNIfConfig |
Typedefs | |
| using | nem_string = const char* |
| using | real = float |
| using | mat2 = mat<real, 2, 2> |
| using | mat3 = mat<real, 3, 3> |
| using | mat4 = mat<real, 4, 4> |
| using | quat = quat_t<nem::real> |
| using | int2 = nem::vec<int , 2> |
| using | int3 = nem::vec<int , 3> |
| using | int4 = nem::vec<int , 4> |
| using | float2 = nem::vec<float , 2> |
| using | float3 = nem::vec<float , 3> |
| using | float4 = nem::vec<float , 4> |
| using | double2 = nem::vec<double, 2> |
| using | double3 = nem::vec<double, 3> |
| using | double4 = nem::vec<double, 4> |
Enumerations | |
| enum class | Precision : unsigned char { Fast = 0 , Accurate = 1 } |
Functions | |
| const char * | GET_C_STRING (nem_string str) |
| template<nem::scalar_type T> | |
| constexpr T | abs_to_rel_error (T x, T abs_error) |
| template<nem::scalar_type T> | |
| constexpr T | eps () |
| template<nem::scalar_type T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | abs_error () |
| template<nem::scalar_type T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | rel_error (T x) |
| template<typename T , size_t C, size_t R> | |
| std::string | tostr (const mat< T, C, R > &matrix) |
| template<typename T , size_t C, size_t R> | |
| std::ostream & | operator<< (std::ostream &os, const mat< T, C, R > &matrix) |
| template<typename T , size_t C, size_t R> | |
| std::istream & | operator>> (std::istream &is, mat< T, C, R > &matrix) |
| template<typename T , size_t C, size_t R, typename F > | |
| constexpr nem::mat< T, C, R > | transform_items (nem::mat< T, C, R > m, F &&func) |
| template<typename T , size_t C, size_t R> | |
| constexpr nem::mat< T, R, C > | transpose (const nem::mat< T, C, R > &m) |
| template<typename T , size_t N> | |
| constexpr nem::mat< T, N, N > | identity () |
| template<typename M > | |
| constexpr nem::mat< typename M::ITEM_TYPE, M::COLUMNS, M::ROWS > | identity () |
| template<typename T , size_t C1, size_t R1, size_t C2, size_t R2> | |
| constexpr nem::mat< T, C2, R2 > | upscale (const nem::mat< T, C1, R1 > &m) |
| template<typename T , size_t N> | |
| constexpr nem::mat< T, N+1, N+1 > | homogenous (const nem::mat< T, N, N > &m) |
| template<typename T > | |
| constexpr T | determinant (const nem::mat< T, 2, 2 > &m) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 2, 2 > | rotate (T radians) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 3, 3 > | rotate_x (nem::sincos< T > a) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 3, 3 > | rotate_y (nem::sincos< T > a) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 3, 3 > | rotate_z (nem::sincos< T > a) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 3, 3 > | rotate (T yaw_z, T pitch_y, T roll_x) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 3, 3 > | translate_2D (const nem::vec< T, 2 > &value) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 4, 4 > | translate_3D (const nem::vec< T, 3 > &value) |
| template<std::floating_point T, size_t N> | |
| constexpr nem::mat< T, N, N > | scale (const nem::vec< T, N > &value) |
| template<std::floating_point T> | |
| constexpr nem::mat< T, 4, 4 > | transform (const nem::vec< T, 3 > &translation, const nem::quat_t< T > &rotation, const nem::vec< T, 3 > scaler) |
| template<std::floating_point T = float, nem::Precision Prec = nem::default_precision> | |
| constexpr T | log2 (T x) |
| template<std::floating_point T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | log (T base, T value) |
| template<std::floating_point T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | ln (T value) |
| template<std::floating_point T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | exp2 (T x) |
| template<nem::scalar_type T, std::integral E> | |
| constexpr T | pow (T base, E exp) |
| template<std::floating_point T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | pow (T base, T exp, nem::unsafe_t) |
| template<std::floating_point T, nem::Precision Prec = nem::default_precision> | |
| constexpr T | pow (T base, T exp, nem::safe_t=nem::safe) |
| template<typename T > | |
| T | sqrt (T value) |
| template<std::floating_point T, int Precision = 20> | |
| constexpr T | csqrt (T value) |
| int | isqrt (unsigned x) |
| int | icbrt (unsigned x) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, const nem::quat_t< T > &q) |
| template<typename T > | |
| std::istream & | operator>> (std::istream &is, nem::quat_t< T > &q) |
| template<typename T > | |
| std::string | to_str (const nem::quat_t< T > &q) |
| template<typename T = nem::real> | |
| constexpr T | sqr_length (const nem::quat_t< T > &q) |
| template<typename T = nem::real> | |
| T | length (const nem::quat_t< T > &q) |
| template<typename T = nem::real> | |
| nem::quat_t< T > | normalize (nem::quat_t< T > q) |
| template<typename T = nem::real> | |
| constexpr nem::quat_t< T > | make_quat (const nem::vec< T, 4 > &vec4) |
| template<typename T = nem::real> | |
| constexpr nem::quat_t< T > | make_quat (T scalar, T x, T y, T z) |
| template<typename T = nem::real> | |
| constexpr nem::quat_t< T > | conjugate (const nem::quat_t< T > &q) |
| Conjugates the quaternion, yielding a quaternion with the same angle (scalar) but inverse axis (vector) | |
| template<typename T = nem::real> | |
| constexpr nem::quat_t< T > | inverse (const nem::quat_t< T > &q) |
| template<typename T = nem::real> | |
| nem::quat_t< T > | from_axis_angle (const nem::vec< T, 3 > &axis, T radians) |
| template<typename T = nem::real> | |
| nem::quat_t< T > | from_euler (T pitch, T yaw, T roll) |
| template<typename T = nem::real> | |
| constexpr nem::mat< T, 3, 3 > | norm_quaterion_to_rotation_matrix (const nem::quat_t< T > &q) |
| template<typename T > | |
| constexpr nem::vec< T, 3 > | extract_vector (const nem::quat_t< T > &q) |
| template<nem::scalar_type T> | |
| constexpr T | degrees (T degrees) noexcept |
| Converts degrees to radians. Used to make units explicit. | |
| template<nem::scalar_type T> | |
| constexpr T | radians (T radians) noexcept |
| Converts radians to radians (passes the argument unchanged). Used to make units explicit. | |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | ft_sin_q1 (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | ft_cos_q1 (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | sin (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | cos (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr nem::sincos< T > | get_sincos (T radians) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | tan (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | ctg (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | sec (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | csc (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | ft_atan_q1 (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | atan (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | atan2 (T y, T x) |
| template<std::floating_point T> | |
| constexpr T | acos (T x) |
| template<std::floating_point T> | |
| constexpr T | asin (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | actg (T x) |
| template<std::floating_point T, int P = DEFAULT_TRIG_PRECISION> | |
| constexpr T | actg2 (T x, T y) |
| template<std::floating_point T> | |
| constexpr T | is_infinite (T value) noexcept |
| template<std::floating_point T> | |
| constexpr T | is_nan (T value) noexcept |
| template<std::floating_point T> | |
| constexpr T | copysign (T to, T from) noexcept |
| Copies the sign of {from} over to {to}. If the signs were the same, it doesn't change. | |
| template<nem::scalar_type T> | |
| constexpr T | sign (T value) noexcept |
| template<typename T > | |
| constexpr T | abs (T value) noexcept |
| template<nem::scalar_type T> | |
| constexpr bool | is_zero (T a) noexcept |
| Is a nearly 0? Given an Epsilon > 0, within each all numbers are considered indistinguisable from 0, |a| < eps. | |
| template<nem::scalar_type T> | |
| constexpr bool | is_zero_or_neg (T a) noexcept |
| template<nem::scalar_type T> | |
| constexpr bool | equal (T a, T b) noexcept |
| Are a and b nearly equal? Given an Epsilon > 0, within each all numbers are considered indistinguisable from 0, |a - b| < eps. | |
| template<nem::scalar_type T> | |
| constexpr T | get_max (T a, T b) noexcept |
| template<nem::scalar_type T> | |
| constexpr T | get_min (T a, T b) noexcept |
| template<nem::scalar_type T> | |
| constexpr T | average (T a, T b) noexcept |
| template<typename T > | |
| constexpr T | pow2 (T value) noexcept |
| template<typename T > | |
| constexpr T | pow3 (T value) noexcept |
| template<typename T > | |
| constexpr T | pow4 (T value) noexcept |
| template<typename T > | |
| constexpr T | sqr (T value) noexcept |
| template<typename T > | |
| constexpr T | cube (T value) noexcept |
| template<nem::scalar_type T> | |
| constexpr T | truncate (T value) noexcept |
| template<nem::scalar_type T> | |
| constexpr T | floor (T value) noexcept |
| Floors always towards -infinity. | |
| template<nem::scalar_type T> | |
| constexpr T | ceil (T value) noexcept |
| Ceils always towards +infinity. | |
| template<nem::scalar_type T> | |
| constexpr T | mod (T a, T b) |
| Calculates euclidean modulo of a % b = r, where r belongs to [0, b). Unline standard C++ modulo operator, works with any floating-point numbers and can never yield negative numbers. | |
| template<std::floating_point T> | |
| constexpr T | frac (T value) noexcept |
| Returns the fractional part of the floating-point number, with respect to sign 3.5 -> 0.5 4.0 -> 0.0 -2.1 -> -0.1. | |
| template<std::floating_point T> | |
| constexpr T | round (T value) noexcept |
| template<std::floating_point T> | |
| constexpr T | floor (T value, T step) |
| template<std::floating_point T> | |
| constexpr T | ceil (T value, T step) |
| template<std::floating_point T> | |
| constexpr T | round (T value, T step) |
| template<nem::scalar_type T> | |
| constexpr T | repeat (T value, T lengthExcl) |
| Unwinds number to 0 when goes past length. Lengh is excluded: when value == lengthExcl, value becomes 0. | |
| template<nem::scalar_type T> | |
| constexpr T | repeat (T value, T minIncl, T maxExcl) |
| Unwinds number to minimum when goes past maximum. Max value is excluded: when value == maxExcl, value becomes minIncl. | |
| template<nem::scalar_type T> | |
| constexpr T | pingpong (T value, T length) |
| template<nem::scalar_type T> | |
| constexpr T | pingpong (T value, T minIncl, T maxExcl) |
| template<std::totally_ordered T> | |
| constexpr T | clamp (T value, T minIncl, T maxIncl) noexcept |
| template<std::totally_ordered T> | |
| constexpr T | clamp01 (T value) noexcept |
| template<typename T > | |
| constexpr T | smoothstep (T edge0, T edge1, T x) |
| template<typename T > | |
| constexpr T | lerp (T a, T b, T t) |
| template<nem::scalar_type T> | |
| constexpr T | remap (T value, T fromMin, T fromMax, T toMin, T toMax) |
| template<std::floating_point T> | |
| constexpr T | is_whole (T value) |
| Is a floating point number whole (same as integer) | |
| template<typename T , size_t N> | |
| std::ostream & | operator<< (std::ostream &os, const nem::vec< T, N > &vec) |
| template<typename T , size_t N> | |
| std::istream & | operator>> (std::istream &is, nem::vec< T, N > &vec) |
| template<typename T , size_t N> | |
| std::string | tostr (const nem::vec< T, N > &vec) |
| template<typename T , size_t N> | |
| bool | is_zero (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| bool | is_zero (const nem::vec< T, N > &&v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | is_infinite (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | is_nan (const nem::vec< T, N > &v) |
| template<std::floating_point T, size_t N> | |
| constexpr nem::vec< T, N > | copysign (const nem::vec< T, N > &to, const nem::vec< T, N > &from) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | sign (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | abs (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr bool | is_zero_or_neg (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr bool | equal (const nem::vec< T, N > &a, const nem::vec< T, N > &b) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | get_max (const nem::vec< T, N > &a, const nem::vec< T, N > &b) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | get_min (const nem::vec< T, N > &a, const nem::vec< T, N > &b) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | average (const nem::vec< T, N > &a, const nem::vec< T, N > &b) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | pow2 (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | pow3 (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | pow4 (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | sqr (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | cube (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | truncate (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | floor (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | ceil (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | mod (const nem::vec< T, N > &a, const nem::vec< T, N > &b) |
| template<std::floating_point T, size_t N> | |
| constexpr nem::vec< T, N > | frac (const nem::vec< T, N > &v) |
| template<std::floating_point T, size_t N> | |
| constexpr nem::vec< T, N > | round (const nem::vec< T, N > &v) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | floor (const nem::vec< T, N > &v, const nem::vec< T, N > &step) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | ceil (const nem::vec< T, N > &v, const nem::vec< T, N > &step) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | round (const nem::vec< T, N > &v, const nem::vec< T, N > &step) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | repeat (const nem::vec< T, N > &value, const nem::vec< T, N > &lengthExcl) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | repeat (const nem::vec< T, N > &value, const nem::vec< T, N > &minIncl, const nem::vec< T, N > &maxExcl) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | pingpong (const nem::vec< T, N > &value, const nem::vec< T, N > &length) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | pingpong (const nem::vec< T, N > &value, const nem::vec< T, N > &minIncl, const nem::vec< T, N > &maxExcl) |
| template<std::totally_ordered T, size_t N> | |
| constexpr nem::vec< T, N > | clamp (const nem::vec< T, N > &value, const nem::vec< T, N > &minIncl, const nem::vec< T, N > &maxIncl) |
| template<std::totally_ordered T, size_t N> | |
| constexpr nem::vec< T, N > | clamp01 (const nem::vec< T, N > &value) |
| template<typename T , size_t N> | |
| constexpr nem::vec< T, N > | smoothstep (const nem::vec< T, N > &edge0, const nem::vec< T, N > &edge1, const nem::vec< T, N > &x) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | remap (const nem::vec< T, N > &value, const nem::vec< T, N > &fromMin, const nem::vec< T, N > &fromMax, const nem::vec< T, N > &toMin, const nem::vec< T, N > &toMax) |
| template<nem::scalar_type T, size_t N> | |
| constexpr nem::vec< T, N > | is_whole (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| T | dot (const nem::vec< T, N > &a, const nem::vec< T, N > &b) |
| template<typename T > | |
| nem::vec< T, 3 > | cross (const nem::vec< T, 3 > &a, const nem::vec< T, 3 > &b) |
| template<typename T , size_t N> | |
| T | horizontal_sum (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| T | horizontal_mul (const nem::vec< T, N > &v) |
| template<typename T , size_t N> | |
| nem::vec< T, N > | reflect (const nem::vec< T, N > &vector, const nem::vec< T, N > &normal) |
| template<typename T , size_t N> | |
| static constexpr nem::vec< T, N > | lerp (const nem::vec< T, N > &a, const nem::vec< T, N > &b, float t) |
| template<typename T , size_t N> | |
| constexpr T | sqr_length (const nem::vec< T, N > &vec) |
| template<typename T , size_t N> | |
| T | length (const nem::vec< T, N > &vec) |
| template<typename T , size_t N> | |
| nem::vec< T, N > | normalize (const nem::vec< T, N > &vec) |
| template<typename T > | |
| bool | orthogonal_3d_basis (const nem::vec< T, 3 > &vector, nem::vec< T, 3 > &b1, nem::vec< T, 3 > &b2) |
Variables | |
| constexpr bool | ERR_THROW = true |
| constexpr bool | ERR_LOG = true |
| constexpr bool | ERR_USE_NAN = true |
| constexpr bool | ERR_SAFE_FALLBACK = false |
| constexpr bool | USE_C_STRING = true |
| constexpr safe_t | safe {} |
| constexpr unsafe_t | unsafe {} |
| constexpr nem::Precision | default_precision = nem::Precision::Fast |
| template<class From , class To > | |
| constexpr bool | is_subset_of_v = is_subset_of<From, To>::value |
| template<std::floating_point T> | |
| constexpr T | SQRT2 = (T)1.414213562373095 |
| template<std::floating_point T> | |
| constexpr T | SQRT3 = (T)1.73205080756887 |
| template<std::floating_point T> | |
| constexpr T | SQRT5 = (T)2.236067977499789 |
| template<std::floating_point T> | |
| constexpr T | PI = (T)3.141592653589793 |
| template<std::floating_point T> | |
| constexpr T | HALF_PI = (T)nem::PI<T> * (T)0.5 |
| template<std::floating_point T> | |
| constexpr T | QUARTER_PI = (T)nem::PI<T> * (T)0.25 |
| template<std::floating_point T> | |
| constexpr T | TWO_PI = (T)nem::PI<T> * (T)2.0 |
| template<std::floating_point T> | |
| constexpr T | E = (T)2.718281828459045 |
| template<std::floating_point T> | |
| constexpr T | ESQR = nem::E<T> * nem::E<T> |
| template<std::floating_point T> | |
| constexpr T | PHI = (T)1.618033988749894 |
| template<std::floating_point T> | |
| constexpr T | DEG_TO_RAD = nem::TWO_PI<T> / (T)360.0 |
| template<std::floating_point T> | |
| constexpr T | RAD_TO_DEG = (T)1.0 / nem::DEG_TO_RAD<T> |
| template<std::floating_point T> | |
| constexpr T | LN2 = (T)0.6931471805599453094 |
| template<std::floating_point T> | |
| constexpr T | LOG2E = (T)1.44269504088896340735992 |
| log(2, e) | |
| static constexpr const char * | MATRIX_COLUMN_SEPARATOR = ", " |
| static constexpr const char * | MATRIX_ROW_SEPARATOR = "\n" |
| static constexpr const char * | MATRIX_L_BRACE = "[" |
| static constexpr const char * | MATRIX_R_BRACE = "]" |
| static constexpr const char * | QUAT_SEPARATOR = " + " |
| static constexpr const char * | QUAT_L_BRACE = "(" |
| static constexpr const char * | QUAT_R_BRACE = ")" |
| static constexpr int | DEFAULT_TRIG_PRECISION = 1 |
| static constexpr float | DEFAULT_TRIG_EPSILON = 0.01f |
| static constexpr const char * | VECTOR_SEPARATOR = ", " |
| static constexpr const char * | VECTOR_L_BRACE = "(" |
| static constexpr const char * | VECTOR_R_BRACE = ")" |
| using nem::double2 = nem::vec<double, 2> |
| using nem::double3 = nem::vec<double, 3> |
| using nem::double4 = nem::vec<double, 4> |
| using nem::float2 = nem::vec<float , 2> |
| using nem::float3 = nem::vec<float , 3> |
| using nem::float4 = nem::vec<float , 4> |
| using nem::nem_string = const char* |
Definition at line 47 of file config.hpp.
| using nem::real = float |
Definition at line 55 of file config.hpp.
|
strong |
| Enumerator | |
|---|---|
| Fast | |
| Accurate | |
Definition at line 66 of file config.hpp.
Definition at line 90 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 144 of file config.hpp.
|
constexpr |
Definition at line 75 of file config.hpp.
|
constexpr |
Minimax polynomial approximation of acos, valid on [-1, 1], with a max error of roughly 6.7e-5. A widely used public-domain approximation (see e.g. "Efficient approximations for the arc cosine function", Lee, 2008, and countless graphics-programming write-ups building on it).
|
constexpr |
|
constexpr |
Two-argument arc-cotangent: the angle whose cotangent is x / y, equivalent to nem::atan2 with the arguments given in x/y order instead of y/x.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Definition at line 153 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 249 of file vec_utils.hpp.
|
constexpr |
Definition at line 308 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Ceils the value to a uniform linear grid with step {step}. Same as normal ceil, when step = 1. Step has to always be positive. (v = 0.9, s = 1.0) -> 1.0 (v = 0.2, s = 1.0) -> 1.0 (v = 0.4, s = 0.25) -> 0.5 (v = 0.1, s = 0.25) -> 0.5 (v = -0.1, s = 0.25) -> 0.0 (v = 423.163123, s = 0.1) -> 423.2
Ceils the value to a uniform linear grid with step {step}. Same as normal ceil, when step = 1. Step has to always be positive. (v = 5, s = 3) -> 3 (v = -4, s = 3) -> -6
|
constexpr |
Definition at line 378 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 389 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Conjugates the quaternion, yielding a quaternion with the same angle (scalar) but inverse axis (vector)
Definition at line 48 of file quat_utils.hpp.
|
constexprnoexcept |
|
constexpr |
|
inline |
Definition at line 457 of file vec_utils.hpp.
|
constexpr |
|
constexpr |
|
constexpr |
Definition at line 212 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexprnoexcept |
|
constexpr |
Definition at line 88 of file mat_utils.hpp.
|
inline |
Definition at line 446 of file vec_utils.hpp.
|
constexpr |
Definition at line 90 of file config.hpp.
|
constexpr |
Definition at line 118 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
|
constexpr |
Definition at line 99 of file quat_utils.hpp.
|
constexpr |
Definition at line 238 of file vec_utils.hpp.
|
constexpr |
|
constexprnoexcept |
|
constexprnoexcept |
Floors the value to a uniform linear grid with step {step}. Same as normal floor, when step = 1. Step has to always be positive. (v = 0.9, s = 1.0) -> 0.0 (v = 0.2, s = 1.0) -> 0.0 (v = 0.4, s = 0.25) -> 0.25 (v = 0.1, s = 0.25) -> 0.0 (v = -0.1, s = 0.25) -> -0.25 (v = 423.163123, s = 0.1) -> 423.1
Floors the value to a uniform linear grid with step {step}. Same as normal floor, when step = 1. Step has to always be positive. (v = 5, s = 3) -> 3 (v = -4, s = 3) -> -6
|
constexpr |
Definition at line 271 of file vec_utils.hpp.
|
constexprnoexcept |
| nem::quat_t< T > nem::from_axis_angle | ( | const nem::vec< T, 3 > & | axis, |
| T | radians ) |
Definition at line 60 of file quat_utils.hpp.
| nem::quat_t< T > nem::from_euler | ( | T | pitch, |
| T | yaw, | ||
| T | roll ) |
Definition at line 72 of file quat_utils.hpp.
|
constexpr |
Core polynomial approximation of atan(x), valid on [-1, 1]. nem::atan reduces any other argument into this range first via atan(x) = sign(x) * HALF_PI - atan(1 / x). Minimax coefficients fitted for P = 1, 2, 3 (max error roughly 5e-3, 6e-4, 8e-5).
|
constexpr |
|
constexpr |
|
inline |
Definition at line 49 of file config.hpp.
|
constexpr |
Definition at line 131 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 142 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Computes sin and cos together in a single range reduction pass, instead of paying for it twice (once per nem::sin/nemcos call). Both quadrant-1 polynomials still have to be evaluated once each (they're different polynomials), but the division + rounding + multiply-subtract range reduction and the sign/abs extraction only happen once.
|
constexpr |
Definition at line 74 of file mat_utils.hpp.
|
inline |
Definition at line 478 of file vec_utils.hpp.
|
inline |
Definition at line 467 of file vec_utils.hpp.
|
inline |
|
constexpr |
Definition at line 39 of file mat_utils.hpp.
|
constexpr |
Definition at line 50 of file mat_utils.hpp.
|
constexpr |
Definition at line 54 of file quat_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 53 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
|
constexpr |
|
inline |
Definition at line 25 of file vec_utils.hpp.
|
inline |
Definition at line 12 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
|
constexprnoexcept |
|
inline |
|
inline |
Definition at line 19 of file quat_utils.hpp.
| T nem::length | ( | const nem::vec< T, N > & | vec | ) |
Definition at line 517 of file vec_utils.hpp.
|
staticconstexpr |
Definition at line 495 of file vec_utils.hpp.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Definition at line 33 of file quat_utils.hpp.
|
constexpr |
Definition at line 39 of file quat_utils.hpp.
|
constexpr |
Definition at line 260 of file vec_utils.hpp.
|
constexpr |
|
constexpr |
Definition at line 81 of file quat_utils.hpp.
Definition at line 523 of file vec_utils.hpp.
|
inline |
Definition at line 25 of file quat_utils.hpp.
| std::ostream & nem::operator<< | ( | std::ostream & | os, |
| const mat< T, C, R > & | matrix ) |
Definition at line 32 of file mat_io.hpp.
| std::ostream & nem::operator<< | ( | std::ostream & | os, |
| const nem::quat_t< T > & | q ) |
Definition at line 16 of file quat_io.hpp.
| std::ostream & nem::operator<< | ( | std::ostream & | os, |
| const nem::vec< T, N > & | vec ) |
Definition at line 16 of file vec_io.hpp.
| std::istream & nem::operator>> | ( | std::istream & | is, |
| mat< T, C, R > & | matrix ) |
Definition at line 48 of file mat_io.hpp.
| std::istream & nem::operator>> | ( | std::istream & | is, |
| nem::quat_t< T > & | q ) |
Definition at line 28 of file quat_io.hpp.
| std::istream & nem::operator>> | ( | std::istream & | is, |
| nem::vec< T, N > & | vec ) |
Definition at line 28 of file vec_io.hpp.
| bool nem::orthogonal_3d_basis | ( | const nem::vec< T, 3 > & | vector, |
| nem::vec< T, 3 > & | b1, | ||
| nem::vec< T, 3 > & | b2 ) |
Definition at line 553 of file vec_utils.hpp.
|
constexpr |
Definition at line 356 of file vec_utils.hpp.
|
constexpr |
Definition at line 367 of file vec_utils.hpp.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexprnoexcept |
Definition at line 179 of file vec_utils.hpp.
|
constexprnoexcept |
Definition at line 190 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexprnoexcept |
|
inline |
Definition at line 489 of file vec_utils.hpp.
|
constexpr |
Definition at line 158 of file config.hpp.
|
constexpr |
|
constexpr |
|
constexpr |
Definition at line 345 of file vec_utils.hpp.
|
constexpr |
|
constexpr |
|
constexpr |
Definition at line 94 of file mat_utils.hpp.
|
constexpr |
Definition at line 119 of file mat_utils.hpp.
|
constexpr |
Definition at line 101 of file mat_utils.hpp.
|
constexpr |
Definition at line 107 of file mat_utils.hpp.
|
constexpr |
Definition at line 113 of file mat_utils.hpp.
|
constexpr |
Definition at line 282 of file vec_utils.hpp.
|
constexpr |
Definition at line 319 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Rounds the value to a uniform linear grid with step {step}. Same as normal round, when step = 1. Step has to always be positive. (v = 0.9, s = 1.0) -> 1.0 (v = 0.2, s = 1.0) -> 0.0 (v = 0.2, s = 0.25) -> 0.25 (v = 0.1, s = 0.25) -> 0.0 (v = -0.1, s = 0.25) -> 0.0 (v = 423.163123, s = 0.1) -> 423.2
Rounds the value to a uniform linear grid with step {step}. Same as normal round, when step = 1. Step has to always be positive. (v = 5, s = 3) -> 6 (v = -4, s = 3) -> -3
|
constexpr |
Definition at line 139 of file mat_utils.hpp.
|
constexpr |
|
constexpr |
Definition at line 79 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
|
constexpr |
Definition at line 201 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 13 of file quat_utils.hpp.
|
constexpr |
Definition at line 506 of file vec_utils.hpp.
|
constexpr |
| std::string nem::to_str | ( | const nem::quat_t< T > & | q | ) |
Definition at line 38 of file quat_io.hpp.
| std::string nem::tostr | ( | const mat< T, C, R > & | matrix | ) |
Definition at line 15 of file mat_io.hpp.
| std::string nem::tostr | ( | const nem::vec< T, N > & | vec | ) |
Definition at line 38 of file vec_io.hpp.
|
constexpr |
Definition at line 150 of file mat_utils.hpp.
|
constexpr |
Definition at line 12 of file mat_utils.hpp.
|
constexpr |
Definition at line 127 of file mat_utils.hpp.
|
constexpr |
Definition at line 133 of file mat_utils.hpp.
|
constexpr |
Definition at line 25 of file mat_utils.hpp.
|
constexpr |
Definition at line 227 of file vec_utils.hpp.
|
constexprnoexcept |
|
constexpr |
Definition at line 57 of file mat_utils.hpp.
|
inlineconstexpr |
Definition at line 72 of file config.hpp.
|
constexpr |
Definition at line 17 of file consts.hpp.
|
constexpr |
Definition at line 14 of file consts.hpp.
|
constexpr |
Definition at line 24 of file config.hpp.
|
constexpr |
Definition at line 38 of file config.hpp.
|
constexpr |
Definition at line 18 of file config.hpp.
|
constexpr |
Definition at line 30 of file config.hpp.
Definition at line 15 of file consts.hpp.
|
constexpr |
Definition at line 11 of file consts.hpp.
|
constexpr |
Definition at line 180 of file config.hpp.
|
constexpr |
Definition at line 19 of file consts.hpp.
|
constexpr |
log(2, e)
Definition at line 22 of file consts.hpp.
|
staticconstexpr |
Definition at line 9 of file mat_io.hpp.
|
staticconstexpr |
Definition at line 11 of file mat_io.hpp.
|
staticconstexpr |
Definition at line 12 of file mat_io.hpp.
|
staticconstexpr |
Definition at line 10 of file mat_io.hpp.
|
constexpr |
Definition at line 16 of file consts.hpp.
|
constexpr |
Definition at line 10 of file consts.hpp.
|
constexpr |
Definition at line 12 of file consts.hpp.
|
staticconstexpr |
Definition at line 12 of file quat_io.hpp.
|
staticconstexpr |
Definition at line 13 of file quat_io.hpp.
|
staticconstexpr |
Definition at line 11 of file quat_io.hpp.
|
constexpr |
Definition at line 18 of file consts.hpp.
|
inlineconstexpr |
Definition at line 63 of file config.hpp.
|
constexpr |
Definition at line 7 of file consts.hpp.
|
constexpr |
Definition at line 8 of file consts.hpp.
|
constexpr |
Definition at line 9 of file consts.hpp.
|
constexpr |
Definition at line 13 of file consts.hpp.
|
inlineconstexpr |
Definition at line 64 of file config.hpp.
|
constexpr |
Definition at line 48 of file config.hpp.
|
staticconstexpr |
Definition at line 12 of file vec_io.hpp.
|
staticconstexpr |
Definition at line 13 of file vec_io.hpp.
|
staticconstexpr |
Definition at line 11 of file vec_io.hpp.