|
mal-math
C++20 mathematics library.
|
#include "mat_math.hpp"Go to the source code of this file.
Namespaces | |
| namespace | mal_math |
| Contains mathematical utility functions and classes. | |
Functions | |
| template<AnyMat U> | |
| constexpr std::istream & | mal_math::operator>> (std::istream &is, U &matrix) |
| Reads a matrix from an input stream. | |
| template<AnyMat U> | |
| constexpr std::ostream & | mal_math::operator<< (std::ostream &os, U const &matrix) |
| Writes a matrix to an output stream. | |
| template<AnyMat U, AnyMat V> requires (U::size.x == V::size.y) | |
| constexpr auto | mal_math::operator* (U const &lhs, V const &rhs) |
| Multiplies two matrices. | |
| template<AnyVec V, AnyMat M> requires (V::size == M::size.y) | |
| constexpr auto | mal_math::operator* (V const &left, M const &right) |
| Multiplies a vector by a matrix. | |
| template<AnyMat M, AnyVec V> requires (M::size.x == V::size) | |
| constexpr auto | mal_math::operator* (M const &left, V const &right) |
| Multiplies a matrix by a vector. | |
| template<AnyMat T, Primitive U> | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::operator* (T const &left, U const right) |
| Multiplies a matrix by a primitive. | |
| template<AnyMat T, Primitive U> | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::operator* (U const left, T const &right) |
| Multiplies a matrix by a primitive. | |
| template<AnyMat T, Primitive U> | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::operator- (T const &left, U const right) |
| Subtracts a matrix from a primitive. | |
| template<AnyMat T, Primitive U> | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::operator+ (U const left, T const &right) |
| Adds a matrix to a primitive. | |
| template<AnyMat T, AnyMat U> requires (T::size.x == U::size.x && T::size.y == U::size.y) | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::operator- (T const left, U const &right) |
| Subtracts two matrices. | |
| template<AnyMat T, AnyMat U> requires (T::size.x == U::size.x && T::size.y == U::size.y) | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::operator+ (T const &left, U const &right) |
| Adds two matrices. | |
| template<AnyMat T> | |
| constexpr mat< T::size.y, T::size.x, std::remove_const_t< typename T::type > > | mal_math::transpose (T const &matrix) |
| Transposes a matrix. | |
| template<AnyMat T> | |
| constexpr rmat< T::size.y, T::size.x, typename T::type > | mal_math::rtranspose (T &matrix) |
| Transposes a matrix and returns a reference to it. | |
| template<AnyMat T> | |
| constexpr rmat< T::size.y, T::size.x, const typename T::type > | mal_math::rctranspose (T const &matrix) |
| Transposes a constant matrix and returns a constant reference to it. | |
| template<AnyMat T> requires (T::size.x == T::size.y && T::size.x == 2) | |
| constexpr T::type | mal_math::det_2 (T const &m) |
| template<AnyMat T> requires (T::size.x == T::size.y && T::size.x == 3) | |
| constexpr T::type | mal_math::det_3 (T const &m) |
| template<AnyMat T> requires (T::size.x == T::size.y && T::size.x == 4) | |
| constexpr T::type | mal_math::det_4 (T const &m) |
| template<AnyMat T> requires (T::size.x == T::size.y) | |
| constexpr T::type | mal_math::det (T const &matrix) |
| Calculates the determinant of a square matrix. | |
| template<AnyMat T> requires (T::size.x == T::size.y) | |
| constexpr T::type | mal_math::determinant (T const &matrix) |
| Calculates the determinant of a square matrix. | |
| template<AnyMat T> requires (T::size.x == T::size.y) | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::adj (T const &m) |
| Computes the adjoint (or adjugate) of a square matrix. | |
| template<AnyMat T> requires (T::size.x == T::size.y) | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::adjugate (T const &m) |
| Alias for the adj() function to compute the adjugate of a matrix. | |
| template<AnyMat T> requires (T::size.x == T::size.y) | |
| constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > | mal_math::inverse (T const &matrix) |
| Calculates the inverse of a square matrix. | |
| template<AnyMat T, AnyVec V> requires (T::size.x == T::size.y && T::size.x == 4 && V::size == 3) | |
| constexpr mat< 4, 4, std::remove_const_t< typename T::type > > | mal_math::translate (T const &matrix, V const &vec) |
| Translates a matrix by a given vector. | |
| template<AnyMat T, Primitive U, AnyVec V> requires (T::size.x == T::size.y && T::size.x == 4 && V::size == 3) | |
| constexpr mat< 4, 4, std::remove_const_t< typename T::type > > | mal_math::rotate (T const &matrix, U angle, V const &axis) |
| Rotates a matrix by a given angle around a given axis. | |
| template<AnyMat T, AnyVec V> requires (T::size.x == T::size.y && T::size.x == 4 && V::size == 3) | |
| constexpr mat< 4, 4, std::remove_const_t< typename T::type > > | mal_math::scale (T const &matrix, V const &scale) |
| Scales a matrix by a given vector. | |
| template<AnyVec Position> requires (Position::size == 3) | |
| constexpr mat< 4, 4, std::remove_const_t< typename Position::type > > | mal_math::look_at (Position const &eye, Position const ¢er, Position const &up) |
| Generates a look-at matrix for camera positioning. | |
| template<Primitive T> requires (!std::numeric_limits<T>::is_integer) | |
| constexpr mat< 4, 4, T > | mal_math::perspective (T fov_y, T aspect_ratio, T z_near, T z_far) |
| Generates a perspective projection matrix. | |
| template<Primitive T> | |
| constexpr mat< 4, 4, T > | mal_math::ortho (T left, T right, T bottom, T top, T zNear, T zFar) |
| Generates an orthographic projection matrix. | |
| template<Primitive T> | |
| constexpr void | mal_math::invert_orthonormal (mat< 4, 4, T > const &src, mat< 4, 4, T > &dst) |
| Inverts an orthonormal matrix in-place and stores the result in a destination matrix. | |
| template<Primitive T> | |
| constexpr void | mal_math::invert_orthogonal (mat< 4, 4, T > const &src, mat< 4, 4, T > &dst) |
| Inverts an orthogonal matrix in-place and stores the result in a destination matrix. | |
| template<Primitive T> | |
| constexpr mat< 4, 4, T > | mal_math::invert_orthonormal (mat< 4, 4, T > const &src) |
| Returns an inverted orthonormal matrix. | |
| template<Primitive T> | |
| constexpr mat< 4, 4, T > | mal_math::invert_orthogonal (mat< 4, 4, T > const &src) |
| Returns an inverted orthogonal matrix. | |