MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
math Namespace Reference

Vector, Matrix, basic operations, etc. More...

Namespaces

namespace  algo
 Algorithms, functors, value interpolation, etc.
 
namespace  geom
 Computation of geometric quantities and predicates.
 
namespace  internal
 Math internals.
 

Classes

class  Accum
 Accumulator class that operates on arbitrary types. More...
 
class  Accum< unsigned char >
 
class  BezierCurve
 A class for defining and evaluating Bezier curves in all dimensions. More...
 
class  BSpline
 Implementation of non-uniform B-Spline curves according to. More...
 
class  Line3
 Class that represents a line using a point and a vector. More...
 
class  Matrix
 Matrix class for arbitrary dimensions and types. More...
 
class  Plane3
 Class that represents a plane in hesse form. More...
 
class  Quaternion
 Quaternion class for arbitrary types (WORK IN PROGRESS). More...
 
class  Vector
 Vector class for arbitrary dimensions and types. More...
 

Typedefs

typedef Line3< double > Line3d
 
typedef Line3< float > Line3f
 
typedef Matrix< double, 2, 2 > Matrix2d
 
typedef Matrix< float, 2, 2 > Matrix2f
 
typedef Matrix< int, 2, 2 > Matrix2i
 
typedef Matrix< unsigned int, 2, 2 > Matrix2ui
 
typedef Matrix< double, 3, 3 > Matrix3d
 
typedef Matrix< float, 3, 3 > Matrix3f
 
typedef Matrix< int, 3, 3 > Matrix3i
 
typedef Matrix< unsigned int, 3, 3 > Matrix3ui
 
typedef Matrix< double, 4, 4 > Matrix4d
 
typedef Matrix< float, 4, 4 > Matrix4f
 
typedef Matrix< int, 4, 4 > Matrix4i
 
typedef Matrix< unsigned int, 4, 4 > Matrix4ui
 
typedef Plane3< double > Plane3d
 
typedef Plane3< float > Plane3f
 
typedef Quaternion< char > Quat4c
 
typedef Quaternion< double > Quat4d
 
typedef Quaternion< float > Quat4f
 
typedef Quaternion< int > Quat4i
 
typedef Quaternion< unsigned char > Quat4uc
 
typedef Quaternion< unsigned int > Quat4ui
 
typedef Vector< float, 128 > Vec128f
 
typedef Vector< unsigned short, 128 > Vec128us
 
typedef Vector< char, 1 > Vec1c
 
typedef Vector< double, 1 > Vec1d
 
typedef Vector< float, 1 > Vec1f
 
typedef Vector< int, 1 > Vec1i
 
typedef Vector< std::size_t, 1 > Vec1st
 
typedef Vector< unsigned char, 1 > Vec1uc
 
typedef Vector< unsigned int, 1 > Vec1ui
 
typedef Vector< unsigned short, 1 > Vec1us
 
typedef Vector< char, 2 > Vec2c
 
typedef Vector< double, 2 > Vec2d
 
typedef Vector< float, 2 > Vec2f
 
typedef Vector< int, 2 > Vec2i
 
typedef Vector< std::size_t, 2 > Vec2st
 
typedef Vector< unsigned char, 2 > Vec2uc
 
typedef Vector< unsigned int, 2 > Vec2ui
 
typedef Vector< unsigned short, 2 > Vec2us
 
typedef Vector< char, 3 > Vec3c
 
typedef Vector< double, 3 > Vec3d
 
typedef Vector< float, 3 > Vec3f
 
typedef Vector< int, 3 > Vec3i
 
typedef Vector< std::size_t, 3 > Vec3st
 
typedef Vector< unsigned char, 3 > Vec3uc
 
typedef Vector< unsigned int, 3 > Vec3ui
 
typedef Vector< unsigned short, 3 > Vec3us
 
typedef Vector< char, 4 > Vec4c
 
typedef Vector< double, 4 > Vec4d
 
typedef Vector< float, 4 > Vec4f
 
typedef Vector< int, 4 > Vec4i
 
typedef Vector< std::size_t, 4 > Vec4st
 
typedef Vector< unsigned char, 4 > Vec4uc
 
typedef Vector< unsigned int, 4 > Vec4ui
 
typedef Vector< unsigned short, 4 > Vec4us
 
typedef Vector< char, 5 > Vec5c
 
typedef Vector< double, 5 > Vec5d
 
typedef Vector< float, 5 > Vec5f
 
typedef Vector< int, 5 > Vec5i
 
typedef Vector< std::size_t, 5 > Vec5st
 
typedef Vector< unsigned char, 5 > Vec5uc
 
typedef Vector< unsigned int, 5 > Vec5ui
 
typedef Vector< unsigned short, 5 > Vec5us
 
typedef Vector< float, 64 > Vec64f
 
typedef Vector< short, 64 > Vec64s
 
typedef Vector< char, 6 > Vec6c
 
typedef Vector< double, 6 > Vec6d
 
typedef Vector< float, 6 > Vec6f
 
typedef Vector< int, 6 > Vec6i
 
typedef Vector< std::size_t, 6 > Vec6st
 
typedef Vector< unsigned char, 6 > Vec6uc
 
typedef Vector< unsigned int, 6 > Vec6ui
 
typedef Vector< unsigned short, 6 > Vec6us
 

Functions

template<typename T >
bound_mirror (T const &v, T const &min, T const &max)
 
template<typename T >
T const & clamp (T const &v, T const &min=T(0), T const &max=T(1))
 Returns value 'v' clamped to the interval specified by 'min' and 'max'.
 
template<typename T >
Vector< T, 3 > cross_product (Vector< T, 3 > const &v1, Vector< T, 3 > const &v2)
 Cross product function for 3-vectors of any type.
 
template<typename T , int N>
Vector< T, N > cross_product (Vector< T, N > const &, Vector< T, N > const &)
 Cross product template for partial specialization.
 
template<typename T , int N>
bool determine_transform (std::vector< math::Vector< T, N > > const &p0, std::vector< math::Vector< T, N > > const &p1, math::Matrix< T, N, N > *rot, T *scale, math::Vector< T, N > *trans)
 
template<typename T >
fastpow (T const &base, unsigned int exp)
 Takes base to the integer power of 'exp'.
 
int from_gray_code (int gc)
 
template<typename T >
gaussian (T const &x, T const &sigma)
 Gaussian function g(x) = exp( -1/2 * (x/sigma)^2 ).
 
template<typename T >
gaussian_2d (T const &x, T const &y, T const &sigma_x, T const &sigma_y)
 Gaussian function in 2D.
 
template<typename T >
gaussian_xx (T const &xx, T const &sigma)
 Gaussian function that expects x to be squared.
 
template<typename T >
interpolate (T const &v1, float w1)
 Generic interpolation (weighting) of a single value.
 
template<typename T >
interpolate (T const &v1, T const &v2, float w1, float w2)
 Generic interpolation between two values.
 
template<typename T >
interpolate (T const &v1, T const &v2, T const &v3, float w1, float w2, float w3)
 Generic interpolation between three values.
 
template<typename T >
interpolate (T const &v1, T const &v2, T const &v3, T const &v4, float w1, float w2, float w3, float w4)
 Generic interpolation between four values.
 
template<>
unsigned char interpolate (unsigned char const &v1, float w1)
 Specific interpolation (weighting) of a value for unsigned char.
 
template<>
unsigned char interpolate (unsigned char const &v1, unsigned char const &v2, float w1, float w2)
 Specific interpolation between two unsigned char values.
 
template<>
unsigned char interpolate (unsigned char const &v1, unsigned char const &v2, unsigned char const &v3, float w1, float w2, float w3)
 Specific interpolation between three unsigned char values.
 
template<>
unsigned char interpolate (unsigned char const &v1, unsigned char const &v2, unsigned char const &v3, unsigned char const &v4, float w1, float w2, float w3, float w4)
 Specific interpolation between four unsigned char values.
 
template<typename T , int N>
bool isnan (Vector< T, N > const &v)
 Tests if any of the vector values is NaN.
 
template<typename T >
matrix_determinant (Matrix< T, 1, 1 > const &mat)
 
template<typename T >
matrix_determinant (Matrix< T, 2, 2 > const &mat)
 
template<typename T >
matrix_determinant (Matrix< T, 3, 3 > const &m)
 
template<typename T >
matrix_determinant (Matrix< T, 4, 4 > const &m)
 
template<typename T , int N>
matrix_determinant (Matrix< T, N, N > const &mat)
 Calculates the determinant of the given matrix.
 
template<typename T , int N>
Matrix< T, N, N > matrix_from_diagonal (math::Vector< T, N > const &v)
 Returns a diagonal matrix from the given vector.
 
template<typename T , int N>
Vector< T, N > matrix_get_diagonal (Matrix< T, N, N > const &mat)
 Returns the diagonal elements of the matrix as a vector.
 
template<typename T >
Matrix< T, 4, 4 > matrix_gl_projection (T const &znear, T const &zfar, T const &top, T const &right)
 Creates a symmetric projection matrix as used in OpenGL.
 
template<typename T , int N>
Matrix< T, N, N > & matrix_inplace_transpose (Matrix< T, N, N > &matrix)
 
template<typename T >
Matrix< T, 1, 1 > matrix_inverse (Matrix< T, 1, 1 > const &, T const &det)
 
template<typename T >
Matrix< T, 1, 1 > matrix_inverse (Matrix< T, 1, 1 > const &mat)
 
template<typename T >
Matrix< T, 2, 2 > matrix_inverse (Matrix< T, 2, 2 > const &mat)
 
template<typename T >
Matrix< T, 2, 2 > matrix_inverse (Matrix< T, 2, 2 > const &mat, T const &det)
 
template<typename T >
Matrix< T, 3, 3 > matrix_inverse (Matrix< T, 3, 3 > const &m)
 
template<typename T >
Matrix< T, 3, 3 > matrix_inverse (Matrix< T, 3, 3 > const &m, T const &det)
 
template<typename T >
Matrix< T, 4, 4 > matrix_inverse (Matrix< T, 4, 4 > const &m)
 
template<typename T , int N>
Matrix< T, N, N > matrix_inverse (Matrix< T, N, N > const &mat)
 Calculates the inverse of the given matrix.
 
template<typename T , int N>
Matrix< T, N, N > matrix_inverse (Matrix< T, N, N > const &mat, T const &det)
 Calculates the inverse of the given matrix given its determinant.
 
template<typename T >
Matrix< T, 4, 4 > matrix_inverse_gl_projection (T const &znear, T const &zfar, T const &top, T const &right)
 Creates a symmetric inverse projection matrix as used in OpenGL.
 
template<typename T >
Matrix< T, 4, 4 > matrix_inverse_viewtrans (Vector< T, 3 > const &campos, Vector< T, 3 > const &viewdir, Vector< T, 3 > const &upvec)
 Creates an inverse view transformation matrix.
 
template<typename T >
Matrix< T, 4, 4 > matrix_invert_trans (Matrix< T, 4, 4 > const &mat)
 Inverts a transformation matrix.
 
template<typename T >
bool matrix_is_diagonal (T *const mat, int rows, int cols, T const &epsilon=T(0))
 Checks whether the input matrix is a diagonal matrix.
 
template<typename T , int N>
bool matrix_is_identity (Matrix< T, N, N > const &mat, T const &epsilon=T(0))
 Returns true if and only if the given matrix is the identity matrix.
 
template<typename T , int N, int M>
bool matrix_is_square (Matrix< T, N, M > const &)
 
template<typename T , int N>
bool matrix_is_square (Matrix< T, N, N > const &)
 
template<typename T >
void matrix_multiply (T const *mat_a, int rows_a, int cols_a, T const *mat_b, int cols_b, T *mat_res)
 Matrix multiplication of dynamically sized dense matrices.
 
template<typename T , int M, int N>
void matrix_pseudo_inverse (Matrix< T, M, N > const &A, Matrix< T, N, M > *result, T const &epsilon=T(1e-12))
 Computes the Moore–Penrose pseudoinverse of matrix A using the SVD.
 
template<typename T , int M, int N>
void matrix_qr (Matrix< T, M, N > const &mat_a, Matrix< T, M, M > *mat_q, Matrix< T, M, N > *mat_r, T const &epsilon=T(1e-12))
 Matrix QR decomposition for compile-time fixed-size matrices.
 
template<typename T >
void matrix_qr (T const *mat_a, int rows, int cols, T *mat_q, T *mat_r, T const &epsilon=T(1e-12))
 Calculates a QR decomposition for a given matrix A.
 
template<typename T , int N>
Matrix< T, N, N > matrix_rotate_180 (Matrix< T, N, N > const &mat_a)
 Rotates the entries of the given matrix by 180 degrees.
 
template<typename T , int N>
void matrix_rotate_180_inplace (Matrix< T, N, N > *mat_a)
 Rotates the entries of the given matrix by 180 degrees in-place.
 
template<typename T >
Matrix< T, 3, 3 > matrix_rotation_from_axis_angle (Vector< T, 3 > const &axis, T const &angle)
 Computes the 3x3 rotation matrix from axis and angle notation.
 
template<typename T , int N>
Matrix< T, N, N > & matrix_set_diagonal (Matrix< T, N, N > &mat, T const *diag)
 Sets the diagonal elements of the given matrix.
 
template<typename T , int N>
Matrix< T, N, N > & matrix_set_identity (Matrix< T, N, N > *mat)
 Sets the given square matrix to the identity matrix.
 
template<typename T >
T * matrix_set_identity (T *mat, int n)
 Sets the given square matrix of dimension 'n' to the identity matrix.
 
template<typename T , int M, int N>
void matrix_svd (Matrix< T, M, N > const &mat_a, Matrix< T, M, N > *mat_u, Matrix< T, N, N > *mat_s, Matrix< T, N, N > *mat_v, T const &epsilon=T(1e-12))
 SVD for compile-time fixed-size matrices.
 
template<typename T >
void matrix_svd (T const *mat_a, int rows, int cols, T *mat_u, T *vec_s, T *mat_v, T const &epsilon=T(1e-12))
 SVD for dynamic-size matrices A of size MxN (M rows, N columns).
 
template<typename T >
void matrix_swap_columns (T *const mat, int rows, int cols, int c1, int c2)
 Swaps the columns c1 and c2 of matrix mat with dimension rows, cols.
 
template<typename T >
void matrix_swap_rows (T *mat, int rows, int cols, int r1, int r2)
 Swaps the rows r1 and r2 of matrix mat with dimension rows, cols.
 
template<typename T , int N>
matrix_trace (math::Matrix< T, N, N > const &mat)
 Calculates the trace of the given matrix.
 
template<typename T >
void matrix_transpose (T *mat, int rows, int cols)
 
template<typename T >
void matrix_transpose (T const *mat, int rows, int cols)
 In-place transpose of a dynamically sized dense matrix.
 
template<typename T >
void matrix_transpose_multiply (T const *mat_a, int rows, int cols, T *mat_res)
 Matrix multiplication of the transposed with itself.
 
template<typename T >
Matrix< T, 4, 4 > matrix_viewtrans (Vector< T, 3 > const &campos, Vector< T, 3 > const &viewdir, Vector< T, 3 > const &upvec)
 Creates a view transformation matrix for camera parameters given as camera position, normalized viewing direction, and normalized up-vector.
 
template<typename T >
T const & max (T const &a, T const &b, T const &c)
 Returns the maximum value of three arguments.
 
template<typename T >
T const & min (T const &a, T const &b, T const &c)
 Returns the minimum value of three arguments.
 
template<typename T , int N>
Vector< T, N > operator* (T const &s, Vector< T, N > const &v)
 Scalar-vector multiplication.
 
template<typename T , int N>
Vector< T, N > operator+ (T const &s, Vector< T, N > const &v)
 Scalar-vector addition.
 
template<typename T , int N>
Vector< T, N > operator- (T const &s, Vector< T, N > const &v)
 Scalar-vector substraction.
 
template<typename T , int N, int M>
std::ostream & operator<< (std::ostream &os, Matrix< T, N, M > const &m)
 Serializing a vector to an output stream.
 
template<typename T , int N>
std::ostream & operator<< (std::ostream &os, Quaternion< T > const &v)
 Serializing a vector to an output stream.
 
template<typename T , int N>
std::ostream & operator<< (std::ostream &os, Vector< T, N > const &v)
 Serializing a vector to an output stream.
 
template<typename T >
std::size_t constexpr popcount (T const x)
 Returns the number of one bits of an integer.
 
template<typename T >
round (T const &x)
 Removes the fractional part of the value to the closest integer.
 
template<typename T >
sinc (T const &x)
 Sinc function.
 
int to_gray_code (int bin)
 

Detailed Description

Vector, Matrix, basic operations, etc.

Typedef Documentation

◆ Line3d

typedef Line3<double> math::Line3d

Definition at line 20 of file line.h.

◆ Line3f

typedef Line3<float> math::Line3f

Definition at line 19 of file line.h.

◆ Matrix2d

typedef Matrix<double, 2, 2> math::Matrix2d

Definition at line 32 of file matrix.h.

◆ Matrix2f

typedef Matrix<float, 2, 2> math::Matrix2f

Definition at line 29 of file matrix.h.

◆ Matrix2i

typedef Matrix<int, 2, 2> math::Matrix2i

Definition at line 35 of file matrix.h.

◆ Matrix2ui

typedef Matrix<unsigned int, 2, 2> math::Matrix2ui

Definition at line 38 of file matrix.h.

◆ Matrix3d

typedef Matrix<double, 3, 3> math::Matrix3d

Definition at line 33 of file matrix.h.

◆ Matrix3f

typedef Matrix<float, 3, 3> math::Matrix3f

Definition at line 30 of file matrix.h.

◆ Matrix3i

typedef Matrix<int, 3, 3> math::Matrix3i

Definition at line 36 of file matrix.h.

◆ Matrix3ui

typedef Matrix<unsigned int, 3, 3> math::Matrix3ui

Definition at line 39 of file matrix.h.

◆ Matrix4d

typedef Matrix<double, 4, 4> math::Matrix4d

Definition at line 34 of file matrix.h.

◆ Matrix4f

typedef Matrix<float, 4, 4> math::Matrix4f

Definition at line 31 of file matrix.h.

◆ Matrix4i

typedef Matrix<int, 4, 4> math::Matrix4i

Definition at line 37 of file matrix.h.

◆ Matrix4ui

typedef Matrix<unsigned int, 4, 4> math::Matrix4ui

Definition at line 40 of file matrix.h.

◆ Plane3d

typedef Plane3<double> math::Plane3d

Definition at line 20 of file plane.h.

◆ Plane3f

typedef Plane3<float> math::Plane3f

Definition at line 19 of file plane.h.

◆ Quat4c

typedef Quaternion<char> math::Quat4c

Definition at line 23 of file quaternion.h.

◆ Quat4d

typedef Quaternion<double> math::Quat4d

Definition at line 20 of file quaternion.h.

◆ Quat4f

typedef Quaternion<float> math::Quat4f

Definition at line 19 of file quaternion.h.

◆ Quat4i

typedef Quaternion<int> math::Quat4i

Definition at line 21 of file quaternion.h.

◆ Quat4uc

typedef Quaternion<unsigned char> math::Quat4uc

Definition at line 24 of file quaternion.h.

◆ Quat4ui

typedef Quaternion<unsigned int> math::Quat4ui

Definition at line 22 of file quaternion.h.

◆ Vec128f

typedef Vector<float,128> math::Vec128f

Definition at line 36 of file vector.h.

◆ Vec128us

typedef Vector<unsigned short,128> math::Vec128us

Definition at line 68 of file vector.h.

◆ Vec1c

typedef Vector<char,1> math::Vec1c

Definition at line 55 of file vector.h.

◆ Vec1d

typedef Vector<double,1> math::Vec1d

Definition at line 37 of file vector.h.

◆ Vec1f

typedef Vector<float,1> math::Vec1f

Definition at line 29 of file vector.h.

◆ Vec1i

typedef Vector<int,1> math::Vec1i

Definition at line 43 of file vector.h.

◆ Vec1st

typedef Vector<std::size_t,1> math::Vec1st

Definition at line 69 of file vector.h.

◆ Vec1uc

typedef Vector<unsigned char,1> math::Vec1uc

Definition at line 61 of file vector.h.

◆ Vec1ui

typedef Vector<unsigned int,1> math::Vec1ui

Definition at line 49 of file vector.h.

◆ Vec1us

typedef Vector<unsigned short,1> math::Vec1us

Definition at line 75 of file vector.h.

◆ Vec2c

typedef Vector<char,2> math::Vec2c

Definition at line 56 of file vector.h.

◆ Vec2d

typedef Vector<double,2> math::Vec2d

Definition at line 38 of file vector.h.

◆ Vec2f

typedef Vector<float,2> math::Vec2f

Definition at line 30 of file vector.h.

◆ Vec2i

typedef Vector<int,2> math::Vec2i

Definition at line 44 of file vector.h.

◆ Vec2st

typedef Vector<std::size_t,2> math::Vec2st

Definition at line 70 of file vector.h.

◆ Vec2uc

typedef Vector<unsigned char,2> math::Vec2uc

Definition at line 62 of file vector.h.

◆ Vec2ui

typedef Vector<unsigned int,2> math::Vec2ui

Definition at line 50 of file vector.h.

◆ Vec2us

typedef Vector<unsigned short,2> math::Vec2us

Definition at line 76 of file vector.h.

◆ Vec3c

typedef Vector<char,3> math::Vec3c

Definition at line 57 of file vector.h.

◆ Vec3d

typedef Vector<double,3> math::Vec3d

Definition at line 39 of file vector.h.

◆ Vec3f

typedef Vector<float,3> math::Vec3f

Definition at line 31 of file vector.h.

◆ Vec3i

typedef Vector<int,3> math::Vec3i

Definition at line 45 of file vector.h.

◆ Vec3st

typedef Vector<std::size_t,3> math::Vec3st

Definition at line 71 of file vector.h.

◆ Vec3uc

typedef Vector<unsigned char,3> math::Vec3uc

Definition at line 63 of file vector.h.

◆ Vec3ui

typedef Vector<unsigned int,3> math::Vec3ui

Definition at line 51 of file vector.h.

◆ Vec3us

typedef Vector<unsigned short,3> math::Vec3us

Definition at line 77 of file vector.h.

◆ Vec4c

typedef Vector<char,4> math::Vec4c

Definition at line 58 of file vector.h.

◆ Vec4d

typedef Vector<double,4> math::Vec4d

Definition at line 40 of file vector.h.

◆ Vec4f

typedef Vector<float,4> math::Vec4f

Definition at line 32 of file vector.h.

◆ Vec4i

typedef Vector<int,4> math::Vec4i

Definition at line 46 of file vector.h.

◆ Vec4st

typedef Vector<std::size_t,4> math::Vec4st

Definition at line 72 of file vector.h.

◆ Vec4uc

typedef Vector<unsigned char,4> math::Vec4uc

Definition at line 64 of file vector.h.

◆ Vec4ui

typedef Vector<unsigned int,4> math::Vec4ui

Definition at line 52 of file vector.h.

◆ Vec4us

typedef Vector<unsigned short,4> math::Vec4us

Definition at line 78 of file vector.h.

◆ Vec5c

typedef Vector<char,5> math::Vec5c

Definition at line 59 of file vector.h.

◆ Vec5d

typedef Vector<double,5> math::Vec5d

Definition at line 41 of file vector.h.

◆ Vec5f

typedef Vector<float,5> math::Vec5f

Definition at line 33 of file vector.h.

◆ Vec5i

typedef Vector<int,5> math::Vec5i

Definition at line 47 of file vector.h.

◆ Vec5st

typedef Vector<std::size_t,5> math::Vec5st

Definition at line 73 of file vector.h.

◆ Vec5uc

typedef Vector<unsigned char,5> math::Vec5uc

Definition at line 65 of file vector.h.

◆ Vec5ui

typedef Vector<unsigned int,5> math::Vec5ui

Definition at line 53 of file vector.h.

◆ Vec5us

typedef Vector<unsigned short,5> math::Vec5us

Definition at line 79 of file vector.h.

◆ Vec64f

typedef Vector<float,64> math::Vec64f

Definition at line 35 of file vector.h.

◆ Vec64s

typedef Vector<short,64> math::Vec64s

Definition at line 67 of file vector.h.

◆ Vec6c

typedef Vector<char,6> math::Vec6c

Definition at line 60 of file vector.h.

◆ Vec6d

typedef Vector<double,6> math::Vec6d

Definition at line 42 of file vector.h.

◆ Vec6f

typedef Vector<float,6> math::Vec6f

Definition at line 34 of file vector.h.

◆ Vec6i

typedef Vector<int,6> math::Vec6i

Definition at line 48 of file vector.h.

◆ Vec6st

typedef Vector<std::size_t,6> math::Vec6st

Definition at line 74 of file vector.h.

◆ Vec6uc

typedef Vector<unsigned char,6> math::Vec6uc

Definition at line 66 of file vector.h.

◆ Vec6ui

typedef Vector<unsigned int,6> math::Vec6ui

Definition at line 54 of file vector.h.

◆ Vec6us

typedef Vector<unsigned short,6> math::Vec6us

Definition at line 80 of file vector.h.

Function Documentation

◆ bound_mirror()

template<typename T >
T math::bound_mirror ( T const &  v,
T const &  min,
T const &  max 
)

Definition at line 211 of file functions.h.

◆ clamp()

template<typename T >
T const & math::clamp ( T const &  v,
T const &  min = T(0),
T const &  max = T(1) 
)

Returns value 'v' clamped to the interval specified by 'min' and 'max'.

Definition at line 204 of file functions.h.

◆ cross_product() [1/2]

template<typename T >
Vector< T, 3 > math::cross_product ( Vector< T, 3 > const &  v1,
Vector< T, 3 > const &  v2 
)
inlineprotected

Cross product function for 3-vectors of any type.

Definition at line 370 of file vector.h.

◆ cross_product() [2/2]

template<typename T , int N>
Vector< T, N > math::cross_product ( Vector< T, N > const &  ,
Vector< T, N > const &   
)
inlineprotected

Cross product template for partial specialization.

Definition at line 362 of file vector.h.

◆ determine_transform()

template<typename T , int N>
bool math::determine_transform ( std::vector< math::Vector< T, N > > const &  p0,
std::vector< math::Vector< T, N > > const &  p1,
math::Matrix< T, N, N > *  rot,
T *  scale,
math::Vector< T, N > *  trans 
)

Definition at line 36 of file transform.h.

◆ fastpow()

template<typename T >
T math::fastpow ( T const &  base,
unsigned int  exp 
)

Takes base to the integer power of 'exp'.

Definition at line 235 of file functions.h.

◆ from_gray_code()

int math::from_gray_code ( int  gc)
inline

Definition at line 254 of file functions.h.

◆ gaussian()

template<typename T >
T math::gaussian ( T const &  x,
T const &  sigma 
)
inline

Gaussian function g(x) = exp( -1/2 * (x/sigma)^2 ).

Gaussian with bell height y=1, bell center x=0 and bell "width" sigma. Useful for at least float and double types.

Definition at line 36 of file functions.h.

◆ gaussian_2d()

template<typename T >
T math::gaussian_2d ( T const &  x,
T const &  y,
T const &  sigma_x,
T const &  sigma_y 
)
inline

Gaussian function in 2D.

Definition at line 59 of file functions.h.

◆ gaussian_xx()

template<typename T >
T math::gaussian_xx ( T const &  xx,
T const &  sigma 
)
inline

Gaussian function that expects x to be squared.

g(x) = exp( -1/2 * xx / sigma^2 ). Gaussian with bell height y=1, bell center x=0 and bell "width" sigma. Useful for at least float and double types.

Definition at line 49 of file functions.h.

◆ interpolate() [1/8]

template<typename T >
T math::interpolate ( T const &  v1,
float  w1 
)
inline

Generic interpolation (weighting) of a single value.

Definition at line 80 of file functions.h.

◆ interpolate() [2/8]

template<typename T >
T math::interpolate ( T const &  v1,
T const &  v2,
float  w1,
float  w2 
)
inline

Generic interpolation between two values.

Definition at line 96 of file functions.h.

◆ interpolate() [3/8]

template<typename T >
T math::interpolate ( T const &  v1,
T const &  v2,
T const &  v3,
float  w1,
float  w2,
float  w3 
)
inline

Generic interpolation between three values.

Definition at line 113 of file functions.h.

◆ interpolate() [4/8]

template<typename T >
T math::interpolate ( T const &  v1,
T const &  v2,
T const &  v3,
T const &  v4,
float  w1,
float  w2,
float  w3,
float  w4 
)
inline

Generic interpolation between four values.

Definition at line 132 of file functions.h.

◆ interpolate() [5/8]

template<>
unsigned char math::interpolate ( unsigned char const &  v1,
float  w1 
)
inline

Specific interpolation (weighting) of a value for unsigned char.

Definition at line 88 of file functions.h.

◆ interpolate() [6/8]

template<>
unsigned char math::interpolate ( unsigned char const &  v1,
unsigned char const &  v2,
float  w1,
float  w2 
)
inline

Specific interpolation between two unsigned char values.

Definition at line 104 of file functions.h.

◆ interpolate() [7/8]

template<>
unsigned char math::interpolate ( unsigned char const &  v1,
unsigned char const &  v2,
unsigned char const &  v3,
float  w1,
float  w2,
float  w3 
)
inline

Specific interpolation between three unsigned char values.

Definition at line 122 of file functions.h.

◆ interpolate() [8/8]

template<>
unsigned char math::interpolate ( unsigned char const &  v1,
unsigned char const &  v2,
unsigned char const &  v3,
unsigned char const &  v4,
float  w1,
float  w2,
float  w3,
float  w4 
)
inline

Specific interpolation between four unsigned char values.

Definition at line 141 of file functions.h.

◆ isnan()

template<typename T , int N>
bool math::isnan ( Vector< T, N > const &  v)
inlineprotected

Tests if any of the vector values is NaN.

Definition at line 810 of file vector.h.

◆ matrix_determinant() [1/5]

template<typename T >
T math::matrix_determinant ( Matrix< T, 1, 1 > const &  mat)
inline

Definition at line 380 of file matrix_tools.h.

◆ matrix_determinant() [2/5]

template<typename T >
T math::matrix_determinant ( Matrix< T, 2, 2 > const &  mat)
inline

Definition at line 387 of file matrix_tools.h.

◆ matrix_determinant() [3/5]

template<typename T >
T math::matrix_determinant ( Matrix< T, 3, 3 > const &  m)
inline

Definition at line 394 of file matrix_tools.h.

◆ matrix_determinant() [4/5]

template<typename T >
T math::matrix_determinant ( Matrix< T, 4, 4 > const &  m)

Definition at line 402 of file matrix_tools.h.

◆ matrix_determinant() [5/5]

template<typename T , int N>
T math::matrix_determinant ( Matrix< T, N, N > const &  mat)

Calculates the determinant of the given matrix.

This is specialized for 1x1, 2x2, 3x3 and 4x4 matrices only.

◆ matrix_from_diagonal()

template<typename T , int N>
Matrix< T, N, N > math::matrix_from_diagonal ( math::Vector< T, N > const &  v)

Returns a diagonal matrix from the given vector.

Definition at line 340 of file matrix_tools.h.

◆ matrix_get_diagonal()

template<typename T , int N>
Vector< T, N > math::matrix_get_diagonal ( Matrix< T, N, N > const &  mat)

Returns the diagonal elements of the matrix as a vector.

Definition at line 360 of file matrix_tools.h.

◆ matrix_gl_projection()

template<typename T >
Matrix< T, 4, 4 > math::matrix_gl_projection ( T const &  znear,
T const &  zfar,
T const &  top,
T const &  right 
)

Creates a symmetric projection matrix as used in OpenGL.

Values in the frustum are mapped to the unit cube. The frustum near plane is defined by z-near, right and top values, the far-plane is located at z-far.

Definition at line 217 of file matrix_tools.h.

◆ matrix_inplace_transpose()

template<typename T , int N>
Matrix< T, N, N > & math::matrix_inplace_transpose ( Matrix< T, N, N > &  matrix)
inlineprotected

Definition at line 282 of file matrix.h.

◆ matrix_inverse() [1/9]

template<typename T >
Matrix< T, 1, 1 > math::matrix_inverse ( Matrix< T, 1, 1 > const &  ,
T const &  det 
)

Definition at line 444 of file matrix_tools.h.

◆ matrix_inverse() [2/9]

template<typename T >
Matrix< T, 1, 1 > math::matrix_inverse ( Matrix< T, 1, 1 > const &  mat)
inline

Definition at line 423 of file matrix_tools.h.

◆ matrix_inverse() [3/9]

template<typename T >
Matrix< T, 2, 2 > math::matrix_inverse ( Matrix< T, 2, 2 > const &  mat)
inline

Definition at line 430 of file matrix_tools.h.

◆ matrix_inverse() [4/9]

template<typename T >
Matrix< T, 2, 2 > math::matrix_inverse ( Matrix< T, 2, 2 > const &  mat,
T const &  det 
)

Definition at line 452 of file matrix_tools.h.

◆ matrix_inverse() [5/9]

template<typename T >
Matrix< T, 3, 3 > math::matrix_inverse ( Matrix< T, 3, 3 > const &  m)
inline

Definition at line 437 of file matrix_tools.h.

◆ matrix_inverse() [6/9]

template<typename T >
Matrix< T, 3, 3 > math::matrix_inverse ( Matrix< T, 3, 3 > const &  m,
T const &  det 
)

Definition at line 462 of file matrix_tools.h.

◆ matrix_inverse() [7/9]

template<typename T >
Matrix< T, 4, 4 > math::matrix_inverse ( Matrix< T, 4, 4 > const &  m)

Definition at line 479 of file matrix_tools.h.

◆ matrix_inverse() [8/9]

template<typename T , int N>
Matrix< T, N, N > math::matrix_inverse ( Matrix< T, N, N > const &  mat)

Calculates the inverse of the given matrix.

This is specialized for 1x1, 2x2, 3x3 and 4x4 matrices only.

◆ matrix_inverse() [9/9]

template<typename T , int N>
Matrix< T, N, N > math::matrix_inverse ( Matrix< T, N, N > const &  mat,
T const &  det 
)

Calculates the inverse of the given matrix given its determinant.

This is specialized for 1x1, 2x2 and 3x3 matrices only.

◆ matrix_inverse_gl_projection()

template<typename T >
Matrix< T, 4, 4 > math::matrix_inverse_gl_projection ( T const &  znear,
T const &  zfar,
T const &  top,
T const &  right 
)

Creates a symmetric inverse projection matrix as used in OpenGL.

Definition at line 232 of file matrix_tools.h.

◆ matrix_inverse_viewtrans()

template<typename T >
Matrix< T, 4, 4 > math::matrix_inverse_viewtrans ( Vector< T, 3 > const &  campos,
Vector< T, 3 > const &  viewdir,
Vector< T, 3 > const &  upvec 
)

Creates an inverse view transformation matrix.

Definition at line 271 of file matrix_tools.h.

◆ matrix_invert_trans()

template<typename T >
Matrix< T, 4, 4 > math::matrix_invert_trans ( Matrix< T, 4, 4 > const &  mat)

Inverts a transformation matrix.

Definition at line 289 of file matrix_tools.h.

◆ matrix_is_diagonal()

template<typename T >
bool math::matrix_is_diagonal ( T *const  mat,
int  rows,
int  cols,
T const &  epsilon = T(0) 
)

Checks whether the input matrix is a diagonal matrix.

This is done by testing if all non-diagonal entries are zero (up to some epsilon).

Definition at line 604 of file matrix_tools.h.

◆ matrix_is_identity()

template<typename T , int N>
bool math::matrix_is_identity ( Matrix< T, N, N > const &  mat,
T const &  epsilon = T(0) 
)

Returns true if and only if the given matrix is the identity matrix.

Definition at line 328 of file matrix_tools.h.

◆ matrix_is_square() [1/2]

template<typename T , int N, int M>
bool math::matrix_is_square ( Matrix< T, N, M > const &  )
inlineprotected

Definition at line 268 of file matrix.h.

◆ matrix_is_square() [2/2]

template<typename T , int N>
bool math::matrix_is_square ( Matrix< T, N, N > const &  )
inlineprotected

Definition at line 275 of file matrix.h.

◆ matrix_multiply()

template<typename T >
void math::matrix_multiply ( T const *  mat_a,
int  rows_a,
int  cols_a,
T const *  mat_b,
int  cols_b,
T *  mat_res 
)

Matrix multiplication of dynamically sized dense matrices.

R = A * B where A is MxN, B is NxL and R is MxL. Compexity: O(n*n*n).

Definition at line 569 of file matrix_tools.h.

◆ matrix_pseudo_inverse()

template<typename T , int M, int N>
void math::matrix_pseudo_inverse ( Matrix< T, M, N > const &  A,
Matrix< T, N, M > *  result,
T const &  epsilon = T( 1e-12 ) 
)

Computes the Moore–Penrose pseudoinverse of matrix A using the SVD.

Let the SVD of A be A = USV*, then the pseudoinverse is A' = VS'U*. The inverse S' of S is obtained by taking the reciprocal of non-zero diagonal elements, leaving zeros (up to the epsilon) in place.

Definition at line 902 of file matrix_svd.h.

◆ matrix_qr() [1/2]

template<typename T , int M, int N>
void math::matrix_qr ( Matrix< T, M, N > const &  mat_a,
Matrix< T, M, M > *  mat_q,
Matrix< T, M, N > *  mat_r,
T const &  epsilon = T(1e-12) 
)

Matrix QR decomposition for compile-time fixed-size matrices.

The implementation uses the dynamic-size matrices interface in the background.

Definition at line 172 of file matrix_qr.h.

◆ matrix_qr() [2/2]

template<typename T >
void math::matrix_qr ( T const *  mat_a,
int  rows,
int  cols,
T *  mat_q,
T *  mat_r,
T const &  epsilon = T(1e-12) 
)

Calculates a QR decomposition for a given matrix A.

A is MxN, Q is MxM and R is MxN. Uses Givens algorithm for computation.

Reference:

  • "Matrix Computations" by Gloub and Loan, 3rd Edition, page 227.

Definition at line 125 of file matrix_qr.h.

◆ matrix_rotate_180()

template<typename T , int N>
Matrix< T, N, N > math::matrix_rotate_180 ( Matrix< T, N, N > const &  mat_a)

Rotates the entries of the given matrix by 180 degrees.

Definition at line 646 of file matrix_tools.h.

◆ matrix_rotate_180_inplace()

template<typename T , int N>
void math::matrix_rotate_180_inplace ( Matrix< T, N, N > *  mat_a)

Rotates the entries of the given matrix by 180 degrees in-place.

Definition at line 638 of file matrix_tools.h.

◆ matrix_rotation_from_axis_angle()

template<typename T >
Matrix< T, 3, 3 > math::matrix_rotation_from_axis_angle ( Vector< T, 3 > const &  axis,
T const &  angle 
)

Computes the 3x3 rotation matrix from axis and angle notation.

Definition at line 525 of file matrix_tools.h.

◆ matrix_set_diagonal()

template<typename T , int N>
Matrix< T, N, N > & math::matrix_set_diagonal ( Matrix< T, N, N > &  mat,
T const *  diag 
)

Sets the diagonal elements of the given matrix.

Definition at line 351 of file matrix_tools.h.

◆ matrix_set_identity() [1/2]

template<typename T , int N>
Matrix< T, N, N > & math::matrix_set_identity ( Matrix< T, N, N > *  mat)

Sets the given square matrix to the identity matrix.

The function returns a reference to the given matrix.

Definition at line 307 of file matrix_tools.h.

◆ matrix_set_identity() [2/2]

template<typename T >
T * math::matrix_set_identity ( T *  mat,
int  n 
)

Sets the given square matrix of dimension 'n' to the identity matrix.

The function returns the argument pointer.

Definition at line 317 of file matrix_tools.h.

◆ matrix_svd() [1/2]

template<typename T , int M, int N>
void math::matrix_svd ( Matrix< T, M, N > const &  mat_a,
Matrix< T, M, N > *  mat_u,
Matrix< T, N, N > *  mat_s,
Matrix< T, N, N > *  mat_v,
T const &  epsilon = T( 1e-12 ) 
)

SVD for compile-time fixed-size matrices.

The implementation of this function uses the dynamic-size matrices interface in the background. Any of the results can be null, however, this does not save operations.

Definition at line 881 of file matrix_svd.h.

◆ matrix_svd() [2/2]

template<typename T >
void math::matrix_svd ( T const *  mat_a,
int  rows,
int  cols,
T *  mat_u,
T *  vec_s,
T *  mat_v,
T const &  epsilon = T( 1e-12 ) 
)

SVD for dynamic-size matrices A of size MxN (M rows, N columns).

The function decomposes input matrix A such that A = USV^T where A is MxN, U is MxN, S is a N-vector and V is NxN. Any of U, S or V can be null, however, this does not save operations.

Usually, M >= N, i.e. the input matrix has more rows than columns. If M > 5/3 N, QR decomposition is used to do an economy SVD after Chan that saves some operations. This SVD also handles the case where M < N. In this case, zero rows are internally added to A until A is a square matrix.

References:

  • "Matrix Computations" by Gloub and Loan (page 455, algo 8.6.2, [GK-SVD])
  • "An Improved Algorithm for Computing the SVD" by Chan (1987) [R-SVD].

Definition at line 699 of file matrix_svd.h.

◆ matrix_swap_columns()

template<typename T >
void math::matrix_swap_columns ( T *const  mat,
int  rows,
int  cols,
int  c1,
int  c2 
)

Swaps the columns c1 and c2 of matrix mat with dimension rows, cols.

Definition at line 620 of file matrix_tools.h.

◆ matrix_swap_rows()

template<typename T >
void math::matrix_swap_rows ( T *  mat,
int  rows,
int  cols,
int  r1,
int  r2 
)

Swaps the rows r1 and r2 of matrix mat with dimension rows, cols.

Definition at line 628 of file matrix_tools.h.

◆ matrix_trace()

template<typename T , int N>
T math::matrix_trace ( math::Matrix< T, N, N > const &  mat)
inline

Calculates the trace of the given matrix.

Definition at line 370 of file matrix_tools.h.

◆ matrix_transpose() [1/2]

template<typename T >
void math::matrix_transpose ( T *  mat,
int  rows,
int  cols 
)

Definition at line 553 of file matrix_tools.h.

◆ matrix_transpose() [2/2]

template<typename T >
void math::matrix_transpose ( T const *  mat,
int  rows,
int  cols 
)

In-place transpose of a dynamically sized dense matrix.

The resulting matrix has number of rows and columns exchanged.

◆ matrix_transpose_multiply()

template<typename T >
void math::matrix_transpose_multiply ( T const *  mat_a,
int  rows,
int  cols,
T *  mat_res 
)

Matrix multiplication of the transposed with itself.

This computes for a given matrix A the product R = A^T * A. The resulting matrix is of size cols times cols.

Definition at line 587 of file matrix_tools.h.

◆ matrix_viewtrans()

template<typename T >
Matrix< T, 4, 4 > math::matrix_viewtrans ( Vector< T, 3 > const &  campos,
Vector< T, 3 > const &  viewdir,
Vector< T, 3 > const &  upvec 
)

Creates a view transformation matrix for camera parameters given as camera position, normalized viewing direction, and normalized up-vector.

Definition at line 247 of file matrix_tools.h.

◆ max()

template<typename T >
T const & math::max ( T const &  a,
T const &  b,
T const &  c 
)

Returns the maximum value of three arguments.

Definition at line 227 of file functions.h.

◆ min()

template<typename T >
T const & math::min ( T const &  a,
T const &  b,
T const &  c 
)

Returns the minimum value of three arguments.

Definition at line 219 of file functions.h.

◆ operator*()

template<typename T , int N>
Vector< T, N > math::operator* ( T const &  s,
Vector< T, N > const &  v 
)
inlineprotected

Scalar-vector multiplication.

Definition at line 786 of file vector.h.

◆ operator+()

template<typename T , int N>
Vector< T, N > math::operator+ ( T const &  s,
Vector< T, N > const &  v 
)
inlineprotected

Scalar-vector addition.

Definition at line 794 of file vector.h.

◆ operator-()

template<typename T , int N>
Vector< T, N > math::operator- ( T const &  s,
Vector< T, N > const &  v 
)
inlineprotected

Scalar-vector substraction.

Definition at line 802 of file vector.h.

◆ operator<<() [1/3]

template<typename T , int N, int M>
std::ostream & math::operator<< ( std::ostream &  os,
Matrix< T, N, M > const &  m 
)
inlineprotected

Serializing a vector to an output stream.

Definition at line 728 of file matrix.h.

◆ operator<<() [2/3]

template<typename T , int N>
std::ostream & math::operator<< ( std::ostream &  os,
Quaternion< T > const &  v 
)
inline

Serializing a vector to an output stream.

Definition at line 292 of file quaternion.h.

◆ operator<<() [3/3]

template<typename T , int N>
std::ostream & math::operator<< ( std::ostream &  os,
Vector< T, N > const &  v 
)
inlineprotected

Serializing a vector to an output stream.

Definition at line 826 of file vector.h.

◆ popcount()

template<typename T >
std::size_t constexpr math::popcount ( T const  x)
constexpr

Returns the number of one bits of an integer.

Definition at line 166 of file functions.h.

◆ round()

template<typename T >
T math::round ( T const &  x)
inline

Removes the fractional part of the value to the closest integer.

Definition at line 70 of file functions.h.

◆ sinc()

template<typename T >
T math::sinc ( T const &  x)
inline

Sinc function.

Definition at line 156 of file functions.h.

◆ to_gray_code()

int math::to_gray_code ( int  bin)
inline

Definition at line 248 of file functions.h.