OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::math Namespace Reference

Math-related code is placed in this namespace. More...

Classes

class  basic_line
 Basic template for lines in N-dimensional space. More...
 
class  basic_sphere
 Basic template for spheres in N-dimensional space. More...
 
class  basic_triangle
 Basic template for triangles in N-dimensional space. More...
 
class  bezier_curves
 A sequence of Bezier curves, possibly connected at end points. More...
 
struct  bezier_t
 Helper class for bezier curve segment calculations. More...
 
struct  constructed_matrix
 Gets the constructed matrix type for a matrix constructor type. More...
 
class  convertible_matrix_constructor
 Helper class used in matrix constructor implementation. More...
 
class  cubic_bezier_loop
 A closed smooth cubic Bezier spline passing through all input points. More...
 
class  identity< matrix< T, R, C, RM, V > >
 Identity matrix constructor. More...
 
struct  is_matrix_constructor
 Indicates if the specified type X is a matrix constructor. More...
 
struct  is_row_major< matrix< T, C, R, RM, V > >
 Class testing if a matrix type is row-major. More...
 
class  looking_at_y_up< matrix< T, 4, 4, RM, V > >
 Implements constructor of look-at matrix used for camera transformations. More...
 
struct  matrix
 Basic RxC matrix implementation template. More...
 
class  orbiting_y_up< matrix< T, 4, 4, RM, V > >
 Implements constructor of orbiting matrix used for camera transformations. More...
 
class  ortho< matrix< T, 4, 4, RM, V > >
 Implements constructor of orthographic projection matrix. More...
 
class  perspective< matrix< T, 4, 4, RM, V > >
 Implements constructor of perspective projection matrix. More...
 
class  reflection_I< matrix< T, 4, 4, RM, V >, I >
 Implements constructor of reflection transformation matrix. More...
 
struct  reordered_matrix< matrix< T, C, R, RM, V > >
 Implementation of reordered_matrix_t. More...
 
class  rotation_I< matrix< T, 4, 4, RM, V >, I >
 Implements constructor of rotation transformation matrix. More...
 
struct  scalar
 Basic scalar implementation template. More...
 
class  scale< matrix< T, 4, 4, RM, V > >
 Implements constructor of scale transformation matrix. More...
 
class  sign
 Class representing a positive or negative numeric sign. More...
 
struct  tmat
 Generic template for RxC dimensional matrices. More...
 
class  translation< matrix< T, 4, 4, RM, V > >
 Implements constructor of translation transformation matrix. More...
 
struct  tvec
 Generic template for N-dimensional vectors. More...
 
class  uniform_scale< matrix< T, 4, 4, RM, V > >
 Implements constructor of uniform scale transformation matrix. More...
 
class  unit_spherical_coordinate
 Class representing unit spherical coordinate. More...
 
struct  vector
 Basic N-dimensional vector implementation template. More...
 

Typedefs

template<typename X >
using reordered_matrix_t = typename reordered_matrix< X >::type
 Trait returns a reordered (switch row/column-major) type for a matrix type.
 
template<typename X >
using constructed_matrix_t = typename constructed_matrix< X >::type
 Trait returning the matrix type constructed by constructor type X.
 
template<typename T , bool V>
using matrix_looking_at_y_up = convertible_matrix_constructor< looking_at_y_up< matrix< T, 4, 4, true, V > >>
 Alias for constructor of look-at matrix used for camera transformations.
 
template<typename T , bool V>
using matrix_orbiting_y_up = convertible_matrix_constructor< orbiting_y_up< matrix< T, 4, 4, true, V > >>
 Alias for constructor of orbiting matrix used for camera transformations.
 
template<typename T , bool V>
using matrix_ortho = convertible_matrix_constructor< ortho< matrix< T, 4, 4, true, V > >>
 Alias for constructor of orthographic projection matrix.
 
template<typename T , bool V>
using matrix_perspective = convertible_matrix_constructor< perspective< matrix< T, 4, 4, true, V > >>
 Alias for constructor of perspective projection matrix.
 
template<typename M >
using reflection_x = reflection_I< M, 0 >
 Alias for implementation of constructor of reflection along x-axis matrix.
 
template<typename M >
using reflection_y = reflection_I< M, 1 >
 Alias for implementation of constructor of reflection along y-axis matrix.
 
template<typename M >
using reflection_z = reflection_I< M, 2 >
 Alias for implementation of constructor of reflection along z-axis matrix.
 
template<typename T , bool V>
using matrix_reflection_x = convertible_matrix_constructor< reflection_x< matrix< T, 4, 4, true, V > >>
 Alias for constructor of reflection along x-axis transformation matrix. More...
 
template<typename T , bool V>
using matrix_reflection_y = convertible_matrix_constructor< reflection_y< matrix< T, 4, 4, true, V > >>
 Alias for constructor of reflection along y-axis transformation matrix. More...
 
template<typename T , bool V>
using matrix_reflection_z = convertible_matrix_constructor< reflection_z< matrix< T, 4, 4, true, V > >>
 Alias for constructor of reflection along z-axis transformation matrix. More...
 
template<typename M >
using rotation_x = rotation_I< M, 0 >
 Alias for implementation of constructor of rotation along x-axis matrix.
 
template<typename M >
using rotation_y = rotation_I< M, 1 >
 Alias for implementation of constructor of rotation along y-axis matrix.
 
template<typename M >
using rotation_z = rotation_I< M, 2 >
 Alias for implementation of constructor of rotation along z-axis matrix.
 
template<typename T , bool V>
using matrix_rotation_x = convertible_matrix_constructor< rotation_x< matrix< T, 4, 4, true, V > >>
 Alias for constructor of rotation along x-axis transformation matrix. More...
 
template<typename T , bool V>
using matrix_rotation_y = convertible_matrix_constructor< rotation_y< matrix< T, 4, 4, true, V > >>
 Alias for constructor of rotation along y-axis transformation matrix. More...
 
template<typename T , bool V>
using matrix_rotation_z = convertible_matrix_constructor< rotation_z< matrix< T, 4, 4, true, V > >>
 Alias for constructor of rotation along z-axis transformation matrix. More...
 
template<typename T , bool V>
using matrix_scale = convertible_matrix_constructor< scale< matrix< T, 4, 4, true, V > >>
 Alias for constructor of scale transformation matrix. More...
 
template<typename T , bool V>
using matrix_uniform_scale = convertible_matrix_constructor< uniform_scale< matrix< T, 4, 4, true, V > >>
 Alias for constructor of uniform scale transformation matrix. More...
 
template<typename T , bool V>
using matrix_translation = convertible_matrix_constructor< translation< matrix< T, 4, 4, true, V > >>
 Alias for constructor of uniform translation transformation matrix. More...
 
template<typename T , bool V>
using line = basic_line< T, 3, V >
 Alias for lines in 3D space.
 
template<typename T , bool V>
using triangle = basic_triangle< T, 3, V >
 Alias for triangles in 3D space.
 
template<typename T , bool V>
using sphere = basic_sphere< T, 3, V >
 Alias for spheres in 3D space.
 

Functions

template<typename T , bool V>
auto 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 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 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 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 signum (T x) noexcept
 Returns 1 if x is non-negative, returns -1 otherwise.
 
template<typename T >
static constexpr auto minimum (T a, T b) noexcept
 Returns the minimum value of a and b.
 
template<typename T , typename... P>
static constexpr auto minimum (T a, T b, T c, P... d) noexcept
 Returns the minimum value from multiple arguments.
 
template<typename T >
static constexpr auto maximum (T a, T b) noexcept
 Returns the maximum value of a and b.
 
template<typename T , typename... P>
static constexpr auto maximum (T a, T b, T c, P... d) noexcept
 Returns the maximum value from multiple arguments.
 
template<typename T >
static constexpr auto 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 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 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 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 blend (T v1, T v2, A alpha) noexcept
 Blends v1 and v2, using alpha as the blending factor.
 
template<typename T >
static constexpr auto inverse_logistic (T x) noexcept
 Calculates the inverse logistic (log(x) - log(1 - x)) of x.
 
template<typename T >
static constexpr auto logistic (T x) noexcept
 Calculates the logistic (1 / (1 + exp(-x))) of x.
 
template<typename T , typename C >
static constexpr auto sigmoid01 (T x, C c) noexcept
 Calculates the sigmoid of x. The value c controls steepness. More...
 
template<typename T >
static constexpr auto sigmoid01 (T x) noexcept
 Calculates the default sigmoid of x. More...
 
template<typename T >
static auto sine_sigmoid01 (T x)
 Calculates goniometric sigmoid (cos in interval (0, 1)) of x. More...
 
template<typename T >
static constexpr auto sine_wave01 (T x) noexcept
 Calculates sine of x, mapped to interval (0, 1). More...
 
template<typename T >
static constexpr auto cosine_wave01 (T x) noexcept
 Calculates cosine of x, mapped to interval (0, 1). More...
 
template<typename T , typename U = T>
static constexpr auto saw (T x, U u=T(1)) noexcept
 Calculates floating-point modulo of x in intervals of u.
 
template<typename T >
static constexpr auto factorial (T n) noexcept -> std::enable_if_t< std::is_integral_v< T >, T >
 Calculates factorial of n.
 
template<typename T >
static constexpr auto 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 interpolate_linear (const T &a, const T &b, C coef)
 Linear interpolation between a and b. More...
 
template<typename T , typename C >
static auto lerp (const T &a, const T &b, C coef)
 Same as interpolate_linear. More...
 
template<typename T , typename C >
static auto 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 smooth_oscillate (const T &a, C coef)
 Smooth interpolation between negative a and a. More...
 
template<typename T , bool V>
static constexpr auto 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 operator* (const MC1 &mc1, const MC2 &mc2) noexcept
 Multiplication operator for matrix constructors. More...
 
template<bool RM, typename MC >
static constexpr auto 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 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 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 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 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 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 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 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 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 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 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 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 dimension (const vector< T, N, V > &) noexcept
 Returns the dimension of a vector.
 
template<typename T , int N, bool V>
static auto 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 dot (const vector< T, N, V > &a, const vector< T, N, V > &b) noexcept
 Vector dot product.
 
template<typename T , bool V>
static auto perpendicular (const vector< T, 2, V > &a) noexcept
 Returns a vector perpendicular to argument.
 
template<typename T , bool V>
static auto 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 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 length (const vector< T, N, V > &a) noexcept
 Returns the length of a vector.
 
template<typename T , int N, bool V>
static auto normalized (const vector< T, N, V > &a) noexcept
 Returns normalized argument.
 
template<typename T , int N, bool V>
static constexpr auto distance (const vector< T, N, V > &a, const vector< T, N, V > &b) noexcept
 Returns the distance between two vectors.
 

Variables

static constexpr const auto pi
 The pi constant. More...
 
static const auto phi
 The phi constant. More...
 
template<typename X >
const auto is_row_major_v
 Trait indicating if a matrix type is row-major.
 
template<typename X >
constexpr auto is_matrix_constructor_v
 Trait indicating if a type X is a matrix constructor. More...
 

Detailed Description

Math-related code is placed in this namespace.


Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).