|
template<typename T , bool V> |
auto | eagine::math::to_cartesian (unit_spherical_coordinate< T, V > c) noexcept -> vector< T, 3, V > |
| Converts unit spherical coordinate to cartesian vector.
|
|
template<typename T , bool V> |
auto | eagine::math::to_unit_spherical (vector< T, 3, V > v) noexcept -> unit_spherical_coordinate< T, V > |
| Converts cartesian vector to unit spherical coordinate.
|
|
template<typename T > |
static constexpr auto | eagine::math::is_positive_power_of_2 (T value) noexcept -> std::enable_if_t< std::is_integral_v< T >, bool > |
| Indicates if value is a positive integral power of two.
|
|
template<typename T > |
static constexpr auto | eagine::math::greatest_common_divisor (T l, T r) noexcept -> std::enable_if_t< std::is_integral_v< T >, T > |
| Returns the greates common divisor of arguments l and r .
|
|
template<typename T > |
static constexpr auto | eagine::math::signum (T x) noexcept |
| Returns 1 if x is non-negative, returns -1 otherwise.
|
|
template<typename T > |
static constexpr auto | eagine::math::minimum (T a, T b) noexcept |
| Returns the minimum value of a and b .
|
|
template<typename T , typename... P> |
static constexpr auto | eagine::math::minimum (T a, T b, T c, P... d) noexcept |
| Returns the minimum value from multiple arguments.
|
|
template<typename T > |
static constexpr auto | eagine::math::maximum (T a, T b) noexcept |
| Returns the maximum value of a and b .
|
|
template<typename T , typename... P> |
static constexpr auto | eagine::math::maximum (T a, T b, T c, P... d) noexcept |
| Returns the maximum value from multiple arguments.
|
|
template<typename T > |
static constexpr auto | eagine::math::ratio (T a, T b) noexcept -> optionally_valid< T > |
| Returns a divided by b if b is not zero.
|
|
template<typename T > |
static constexpr auto | eagine::math::reciprocal (T x) noexcept -> optionally_valid< T > |
| Returns the reciprocal of x if x is not zero.
|
|
template<typename T , typename Min , typename Max > |
static constexpr auto | eagine::math::clamp (T x, Min min, Max max) noexcept |
| Clamps x to be between min and max .
|
|
template<typename T , typename S , typename E > |
static constexpr auto | eagine::math::ramp (T x, S start, E end) noexcept |
| Normalizes x to (0, 1), where start = 0 and end = 1.
|
|
template<typename T , typename A > |
static constexpr auto | eagine::math::blend (T v1, T v2, A alpha) noexcept |
| Blends v1 and v2 , using alpha as the blending factor.
|
|
template<typename T > |
static constexpr auto | eagine::math::inverse_logistic (T x) noexcept |
| Calculates the inverse logistic (log(x) - log(1 - x)) of x .
|
|
template<typename T > |
static constexpr auto | eagine::math::logistic (T x) noexcept |
| Calculates the logistic (1 / (1 + exp(-x))) of x .
|
|
template<typename T , typename C > |
static constexpr auto | eagine::math::sigmoid01 (T x, C c) noexcept |
| Calculates the sigmoid of x . The value c controls steepness. More...
|
|
template<typename T > |
static constexpr auto | eagine::math::sigmoid01 (T x) noexcept |
| Calculates the default sigmoid of x . More...
|
|
template<typename T > |
static auto | eagine::math::sine_sigmoid01 (T x) |
| Calculates goniometric sigmoid (cos in interval (0, 1)) of x . More...
|
|
template<typename T > |
static constexpr auto | eagine::math::sine_wave01 (T x) noexcept |
| Calculates sine of x , mapped to interval (0, 1). More...
|
|
template<typename T > |
static constexpr auto | eagine::math::cosine_wave01 (T x) noexcept |
| Calculates cosine of x , mapped to interval (0, 1). More...
|
|
template<typename T , typename U = T> |
static constexpr auto | eagine::math::saw (T x, U u=T(1)) noexcept |
| Calculates floating-point modulo of x in intervals of u .
|
|
template<typename T > |
static constexpr auto | eagine::math::factorial (T n) noexcept -> std::enable_if_t< std::is_integral_v< T >, T > |
| Calculates factorial of n .
|
|
template<typename T > |
static constexpr auto | eagine::math::binomial (T n, T k) noexcept -> std::enable_if_t< std::is_integral_v< T >, T > |
| Calculates binomial coefficient of n over k .
|
|
template<typename T , typename C > |
static auto | eagine::math::interpolate_linear (const T &a, const T &b, C coef) |
| Linear interpolation between a and b . More...
|
|
template<typename T , typename C > |
static auto | eagine::math::lerp (const T &a, const T &b, C coef) |
| Same as interpolate_linear. More...
|
|
template<typename T , typename C > |
static auto | eagine::math::smooth_lerp (const T &a, const T &b, C coef) |
| Linear interpolation with coef transformed by sine_sigmoid01. More...
|
|
template<typename T , typename C > |
static auto | eagine::math::smooth_oscillate (const T &a, C coef) |
| Smooth interpolation between negative a and a . More...
|
|
template<typename T , bool V> |
static constexpr auto | eagine::math::line_sphere_intersection (const line< T, V > &ray, const sphere< T, V > &sph) noexcept -> std::pair< optionally_valid< vector< T, 3, V >>, optionally_valid< vector< T, 3, V >>> |
| Finds line-sphere intersection points. More...
|
|
template<typename T , bool V> |
static constexpr auto | eagine::math::nearest_line_sphere_intersection (const line< T, V > &ray, const sphere< T, V > &sph) noexcept -> optionally_valid< vector< T, 3, V >> |
| Finds nearest line-sphere intersection point. More...
|
|
template<typename T , bool V> |
static auto | eagine::math::line_triangle_intersection (const line< T, V > &ray, const triangle< T, V > &tri) noexcept -> optionally_valid< vector< T, 3, V >> |
| Finds line-triangle intersection point.
|
|
template<typename T , int N, bool V> |
static auto | eagine::math::operator<< (std::ostream &o, const vector< T, N, V > &v) -> std::ostream & |
| Operator for writing vector into output stream.
|
|
template<typename T , int C, int R, bool V> |
static auto | eagine::math::operator<< (std::ostream &o, const matrix< T, C, R, true, V > &m) -> std::ostream & |
| Operator for writing row-major matrix into output stream.
|
|
template<typename T , int C, int R, bool V> |
static auto | eagine::math::operator<< (std::ostream &o, const matrix< T, C, R, false, V > &m) -> std::ostream & |
| Operator for writing column-major matrix into output stream.
|
|
template<typename T , int N, bool V> |
static auto | eagine::math::operator<< (std::ostream &o, const basic_line< T, N, V > &l) -> std::ostream & |
| Operator for writing line into output stream.
|
|
template<typename T , int N, bool V> |
static auto | eagine::math::operator<< (std::ostream &o, const basic_triangle< T, N, V > &t) -> std::ostream & |
| Operator for writing triangle into output stream.
|
|
template<typename T , bool V> |
static auto | eagine::math::operator<< (std::ostream &o, const sphere< T, V > &s) -> std::ostream & |
| Operator for writing sphere into output stream.
|
|
template<typename T , int C, int R, bool RM, bool V> |
static constexpr auto | eagine::math::rows (const matrix< T, C, R, RM, V > &) noexcept |
| Returns then number of matrix rows.
|
|
template<typename T , int C, int R, bool RM, bool V> |
static constexpr auto | eagine::math::columns (const matrix< T, C, R, RM, V > &) noexcept |
| Returns then number of matrix columns.
|
|
template<typename T , int C, int R, bool RM, bool V> |
static constexpr auto | eagine::math::row_major (const matrix< T, C, R, RM, V > &) noexcept |
| Indicates if a matrix is row-major.
|
|
template<typename T , int N, bool RM, bool V> |
static constexpr auto | eagine::math::dimension (const matrix< T, N, N, RM, V > &) noexcept |
| Returns the dimension of a square matrix.
|
|
template<int CI, int RI, typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_cm (const matrix< T, C, R, false, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T > |
| Returns the matrix element at [CI, RI]. Column-major implementation.
|
|
template<int CI, int RI, typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_cm (const matrix< T, C, R, true, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T > |
| Returns the matrix element at [CI, RI]. Row-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_cm (const matrix< T, C, R, false, V > &m, int ci, int ri) noexcept -> T |
| Returns the matrix element at [ci, ri]. Column-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_cm (const matrix< T, C, R, true, V > &m, int ci, int ri) noexcept -> T |
| Returns the matrix element at [ci, ri]. Row-major implementation.
|
|
template<int RI, int CI, typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_rm (const matrix< T, C, R, false, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T > |
| Returns the matrix element at [RI, CI]. Column-major implementation.
|
|
template<int RI, int CI, typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_rm (const matrix< T, C, R, true, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T > |
| Returns the matrix element at [RI, CI]. Row-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_rm (const matrix< T, C, R, false, V > &m, int ri, int ci) noexcept -> T |
| Returns the matrix element at [ri, ci]. Column-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::get_rm (const matrix< T, C, R, true, V > &m, int ri, int ci) noexcept -> T |
| Returns the matrix element at [ri, ci]. Row-major implementation.
|
|
template<int CI, int RI, typename T , int C, int R, bool V> |
static auto | eagine::math::set_cm (matrix< T, C, R, false, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)> |
| Sets the matrix element at [CI, RI]. Column-major implementation.
|
|
template<int CI, int RI, typename T , int C, int R, bool V> |
static auto | eagine::math::set_cm (matrix< T, C, R, true, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)> |
| Sets the matrix element at [CI, RI]. Row-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static void | eagine::math::set_cm (matrix< T, C, R, false, V > &m, int ci, int ri, T v) noexcept |
| Sets the matrix element at [ci, ri]. Column-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static void | eagine::math::set_cm (matrix< T, C, R, true, V > &m, int ci, int ri, T v) noexcept |
| Sets the matrix element at [ci, ri]. Row-major implementation.
|
|
template<int RI, int CI, typename T , int C, int R, bool V> |
static auto | eagine::math::set_rm (matrix< T, C, R, false, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)> |
| Sets the matrix element at [RI, CI]. Column-major implementation.
|
|
template<int RI, int CI, typename T , int C, int R, bool V> |
static auto | eagine::math::set_rm (matrix< T, C, R, true, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)> |
| Sets the matrix element at [RI, CI]. Row-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static void | eagine::math::set_rm (matrix< T, C, R, false, V > &m, int ri, int ci, T v) noexcept |
| Sets the matrix element at [ri, ci]. Column-major implementation.
|
|
template<typename T , int C, int R, bool V> |
static void | eagine::math::set_rm (matrix< T, C, R, true, V > &m, int ri, int ci, T v) noexcept |
| Sets the matrix element at [ri, ci]. Row-major implementation.
|
|
template<typename T , int C, int R, bool RM, bool V> |
static auto | eagine::math::transpose (const matrix< T, C, R, RM, V > &m) noexcept -> matrix< T, R, C, RM, V > |
| Transposes a matrix.
|
|
template<typename T , int C, int R, bool RM, bool V> |
static auto | eagine::math::reorder (const matrix< T, C, R, RM, V > &m) noexcept -> matrix< T, C, R, !RM, V > |
| Returns a matrix reordered (switches row/column major).
|
|
template<typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::make_row_major (matrix< T, C, R, true, V > m) noexcept -> matrix< T, C, R, true, V > |
| Returns a matrix ordered as row-major.
|
|
template<typename T , int C, int R, bool V> |
static auto | eagine::math::make_row_major (const matrix< T, C, R, false, V > &m) noexcept -> matrix< T, C, R, true, V > |
| Returns a matrix ordered as row-major.
|
|
template<typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::make_column_major (matrix< T, C, R, false, V > m) noexcept -> matrix< T, C, R, false, V > |
| Returns a matrix ordered as column-major.
|
|
template<typename T , int C, int R, bool V> |
static auto | eagine::math::make_column_major (const matrix< T, C, R, true, V > &m) noexcept -> matrix< T, C, R, false, V > |
| Returns a matrix ordered as column-major.
|
|
template<int I, typename T , int C, int R, bool RM, bool V> |
static constexpr auto | eagine::math::major_vector (const matrix< T, C, R, RM, V > &m) noexcept -> std::enable_if_t<(I<(RM ? R :C)), vector< T,(RM ? C :R), V >> |
| Returns the I-th major vector of a matrix.
|
|
template<int I, typename T , int C, int R, bool RM, bool V> |
static auto | eagine::math::minor_vector (const matrix< T, C, R, RM, V > &m) noexcept -> std::enable_if_t<(I<(RM ? C :R)), vector< T,(RM ? R :C), V >> |
| Returns the I-th minor vector of a matrix.
|
|
template<int I, typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::row (const matrix< T, C, R, true, V > &m) noexcept -> vector< T, C, V > |
| Returns the I-th row vector of a matrix. Row-major implementation.
|
|
template<int I, typename T , int C, int R, bool V> |
static auto | eagine::math::row (const matrix< T, C, R, false, V > &m) noexcept -> vector< T, C, V > |
| Returns the I-th row vector of a matrix. Column-major implementation.
|
|
template<typename T , int R, int C, bool RM, bool V> |
static auto | eagine::math::row (const matrix< T, C, R, RM, V > &m, int i) noexcept -> vector< T, C, V > |
| Returns the i-th row vector of a matrix.
|
|
template<int I, typename T , int C, int R, bool V> |
static constexpr auto | eagine::math::column (const matrix< T, C, R, false, V > &m) noexcept -> vector< T, R, V > |
| Returns the I-th column vector of a matrix. Column-major implementation.
|
|
template<int I, typename T , int C, int R, bool V> |
static auto | eagine::math::column (const matrix< T, C, R, true, V > &m) noexcept -> vector< T, R, V > |
| Returns the I-th column vector of a matrix. Row-major implementation.
|
|
template<typename T , int R, int C, bool RM, bool V> |
static auto | eagine::math::column (const matrix< T, C, R, RM, V > &m, int i) noexcept -> vector< T, R, V > |
| Returns the i-th column vector of a matrix.
|
|
template<typename T , int M, int N, int K, bool RM1, bool RM2, bool V> |
static auto | eagine::math::multiply (const matrix< T, K, M, RM1, V > &m1, const matrix< T, N, K, RM2, V > &m2) noexcept -> matrix< T, N, M, RM1, V > |
| Matrix multiplication function.
|
|
template<typename T , int C, int R, bool RM, bool V> |
static auto | eagine::math::multiply (const matrix< T, C, R, RM, V > &m, const vector< T, C, V > &v) noexcept -> vector< T, R, V > |
| Matrix-vector multiplication function.
|
|
template<typename MC1 , typename MC2 , typename = std::enable_if_t< is_matrix_constructor<MC1>::value && is_matrix_constructor<MC2>::value && are_multiplicable<constructed_matrix_t<MC1>, constructed_matrix_t<MC2>>::value>> |
static auto | eagine::math::operator* (const MC1 &mc1, const MC2 &mc2) noexcept |
| Multiplication operator for matrix constructors. More...
|
|
template<bool RM, typename MC > |
static constexpr auto | eagine::math::construct_matrix (const MC &c) noexcept -> std::enable_if_t< is_matrix_constructor_v< MC > &&is_row_major_v< constructed_matrix_t< MC >>==RM, constructed_matrix_t< MC >> |
| Uses the specified matrix constructor c to construct a matrix.
|
|
template<typename MC1 , typename MC2 , typename = std::enable_if_t< is_matrix_constructor_v<MC1> && is_matrix_constructor_v<MC2> && are_multiplicable<constructed_matrix_t<MC1>, constructed_matrix_t<MC2>>::value>> |
static auto | eagine::math::multiply (const MC1 &mc1, const MC2 &mc2) noexcept |
| Multiplies the results of two matrix constructors. More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_elimination (matrix< T, Ca, R, true, V > &a, matrix< T, Cb, R, true, V > &b) noexcept -> bool |
| Implements gaussian elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_elimination (matrix< T, Ca, R, false, V > &a, matrix< T, Cb, R, true, V > &b) noexcept -> bool |
| Implements gaussian elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_elimination (matrix< T, Ca, R, true, V > &a, matrix< T, Cb, R, false, V > &b) noexcept -> bool |
| Implements gaussian elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_elimination (matrix< T, Ca, R, false, V > &a, matrix< T, Cb, R, false, V > &b) noexcept -> bool |
| Implements gaussian elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_jordan_elimination (matrix< T, Ca, R, true, V > &a, matrix< T, Cb, R, true, V > &b) noexcept -> bool |
| Implements gauss-jordan elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_jordan_elimination (matrix< T, Ca, R, false, V > &a, matrix< T, Cb, R, true, V > &b) noexcept -> bool |
| Implements gauss-jordan elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_jordan_elimination (matrix< T, Ca, R, true, V > &a, matrix< T, Cb, R, false, V > &b) noexcept -> bool |
| Implements gauss-jordan elimination on matrices a and b . More...
|
|
template<typename T , int Ca, int Cb, int R, bool V> |
static auto | eagine::math::gauss_jordan_elimination (matrix< T, Ca, R, false, V > &a, matrix< T, Cb, R, false, V > &b) noexcept -> bool |
| Implements gauss-jordan elimination on matrices a and b . More...
|
|
template<typename T , int N, bool RM, bool V> |
static auto | eagine::math::inverse_matrix (matrix< T, N, N, RM, V > m) noexcept -> optionally_valid< matrix< T, N, N, RM, V >> |
| Returns the inverse matrix to the matrix passed as argument.
|
|
template<typename Ctr , typename = std::enable_if_t<is_matrix_constructor_v<Ctr>>> |
static auto | eagine::math::inverse_matrix (const Ctr &ctr) noexcept |
| Returns the inverse matrix to the matrix constructed by the argument.
|
|
template<typename T , int N, bool V> |
static constexpr auto | eagine::math::dimension (const vector< T, N, V > &) noexcept |
| Returns the dimension of a vector.
|
|
template<typename T , int N, bool V> |
static auto | eagine::math::is_zero (const vector< T, N, V > &v) noexcept -> bool |
| Tests if a vector has zero lenght.
|
|
template<typename T , int N, bool V> |
static constexpr auto | eagine::math::dot (const vector< T, N, V > &a, const vector< T, N, V > &b) noexcept |
| Vector dot product.
|
|
template<typename T , bool V> |
static auto | eagine::math::perpendicular (const vector< T, 2, V > &a) noexcept |
| Returns a vector perpendicular to argument.
|
|
template<typename T , bool V> |
static auto | eagine::math::cross (const vector< T, 3, V > &a, const vector< T, 3, V > &b) noexcept |
| 3D vector cross product.
|
|
template<typename T , int N, bool V> |
static constexpr auto | eagine::math::magnitude (const vector< T, N, V > &a) noexcept |
| Returns the magnitude of a vector. Same as length.
|
|
template<typename T , int N, bool V> |
static constexpr auto | eagine::math::length (const vector< T, N, V > &a) noexcept |
| Returns the length of a vector.
|
|
template<typename T , int N, bool V> |
static auto | eagine::math::normalized (const vector< T, N, V > &a) noexcept |
| Returns normalized argument.
|
|
template<typename T , int N, bool V> |
static constexpr auto | eagine::math::distance (const vector< T, N, V > &a, const vector< T, N, V > &b) noexcept |
| Returns the distance between two vectors.
|
|