4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
fcppt::math::matrix Namespace Reference

Contains fcppt::math::matrix::object matrix::object and helper functions, classes and types for it. More...

Classes

struct  has_dim
 Metafunction to check if a static matrix has the specified dimensions. More...
 
struct  has_dim< fcppt::math::matrix::object< T, R, C, S >, DR, DC >
 
struct  index
 A static matrix index. More...
 
struct  is_matrix
 Metafunction to test if a type is a matrix type. More...
 
struct  is_matrix< fcppt::math::matrix::object< T, R, C, S > >
 
class  object
 A class representing a static matrix. More...
 

Typedefs

template<typename T , fcppt::math::size_type C>
using row_type = fcppt::math::vector::static_< T, C >
 The type of matrix row.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C>
using static_ = fcppt::math::matrix::object< T, R, C, fcppt::math::matrix::detail::static_storage< T, R, C > >
 Typedef helper for static matrices.
 
template<typename Matrix >
using to_static = fcppt::math::matrix::static_< fcppt::type_traits::value_type< Matrix >, Matrix::static_rows::value, Matrix::static_columns::value >
 The static type of a matrix.
 

Functions

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, Nadjugate (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
 Calculates the adjugate matrix.
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left,+, Right), R, Coperator+ (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::matrix::object< Right, R, C, S2 > const &_right)
 Adds two matrices.
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, -, Right), R, Coperator- (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::matrix::object< Right, R, C, S2 > const &_right)
 Subtracts one matrix from another.
 
template<typename L , typename R , fcppt::math::size_type N, fcppt::math::size_type M1, fcppt::math::size_type M2, typename S1 , typename S2 >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, *, R), M1, M2operator* (fcppt::math::matrix::object< L, M1, N, S1 > const &_left, fcppt::math::matrix::object< R, N, M2, S2 > const &_right)
 Multiplies two matrices.
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, *, Right), R, Coperator* (fcppt::math::matrix::object< Left, R, C, S > const &_left, Right const &_right)
 Multiplies a matrix by a scalar.
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, *, Right), R, Coperator* (Left const &_left, fcppt::math::matrix::object< Right, R, C, S > const &_right)
 Multiplies a matrix by a scalar.
 
template<fcppt::math::size_type Index, typename Matrix >
fcppt::container::to_reference_type< std::remove_reference_t< Matrix > > at_r (Matrix &_value)
 Access a row using a compile-time constant.
 
template<fcppt::math::size_type R, fcppt::math::size_type C, typename Matrix >
fcppt::container::to_reference_type< fcppt::container::to_reference_type< std::remove_reference_t< Matrix > > > at_r_c (Matrix &_value)
 Access an element using compile-time constants for both row and column.
 
template<typename T1 , typename T2 , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 , typename Function >
fcppt::math::matrix::static_< std::invoke_result_t< Function, T1, T2 >, R, Cbinary_map (fcppt::math::matrix::object< T1, R, C, S1 > const &_left, fcppt::math::matrix::object< T2, R, C, S2 > const &_right, Function const &_function)
 Maps over two matrixs.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool operator== (fcppt::math::matrix::object< T, R, C, S1 > const &_m1, fcppt::math::matrix::object< T, R, C, S2 > const &_m2)
 Compares two matrices component-wise.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool operator!= (fcppt::math::matrix::object< T, R, C, S1 > const &_m1, fcppt::math::matrix::object< T, R, C, S2 > const &_m2)
 Compares two matrices component-wise.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool componentwise_equal (fcppt::math::matrix::object< T, R, C, S1 > const &_m1, fcppt::math::matrix::object< T, R, C, S2 > const &_m2, T const _epsilon)
 Compares two floating point matrices componentwise using an epsilon.
 
template<fcppt::math::size_type DR, fcppt::math::size_type DC, typename T , typename S , fcppt::math::size_type R, fcppt::math::size_type C>
fcppt::math::matrix::static_< T, R - 1U, C - 1Udelete_row_and_column (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Deletes a specific row and rolumn (a cross) from the matrix.
 
template<typename T , fcppt::math::size_type N, typename S >
T determinant (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
 Calculates the determinant of a matrix.
 
template<typename T , fcppt::math::size_type DN, typename S >
fcppt::math::matrix::static_< T, DN, DNexponential_pade (fcppt::math::matrix::object< T, DN, DN, S > const &_matrix)
 Calculates the matrix exponential e^A using a Pade approximation.
 
template<typename Matrix >
fcppt::math::matrix::to_static< Matrixidentity ()
 Returns the identity matrix;.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
T infinity_norm (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Calculates the infinity norm.
 
template<typename Matrix , typename Function >
Matrix init (Function const &_function)
 Initializes a matrix.
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, Ninverse (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
 Calculates the inverse matrix, uses fcppt::math::matrix::adjugate and fcppt::math::matrix::determinant.
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, Nlogarithm (fcppt::math::matrix::object< T, N, N, S > A, T const e1, T const e2, T const e3)
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Function >
fcppt::math::matrix::static_< std::invoke_result_t< Function, T >, R, Cmap (fcppt::math::matrix::object< T, R, C, S > const &_value, Function const &_function)
 Maps over the elements of a matrix.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Ch , typename Traits >
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Outputs the matrix to a basic_ostream
 
template<typename T >
fcppt::math::matrix::static_< T, 2, 2 > rotation_2d (T const _angle)
 Calculates a two dimensional rotation matrix.
 
template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > rotation_axis (T const _angle, fcppt::math::vector::object< T, 3, S > const &_vector)
 Calculates a 4x4 rotation matrix around an arbitrary axis given as a unit vector.
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > rotation_x (T const _angle)
 Calculates a 4x4 rotation matrix around the x axis.
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > rotation_y (T const _angle)
 Calculates a 4x4 rotation matrix around the y axis.
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > rotation_z (T const _angle)
 Calculates a 4x4 rotation matrix around the z axis.
 
template<typename Type , typename... Args, typename = std::enable_if_t< std::conjunction_v<std::is_same<std::remove_cvref_t<Args>, std::remove_cvref_t<Type>>...>>>
fcppt::math::matrix::row_type< std::remove_cvref_t< Type >, fcppt::cast::size< fcppt::math::size_type >(sizeof...(Args)+1U)> row (Type &&_value, Args &&..._args)
 Creates a matrix row for initialization.
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > scaling (T const _x, T const _y, T const _z)
 Calculates a 4x4 scaling matrix.
 
template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > scaling (fcppt::math::vector::object< T, 3, S > const &_vec)
 Calculates a scaling matrix from a three dimensional vector.
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, Nsqrt (fcppt::math::matrix::object< T, N, N, S > const &_matrix, T const _epsilon)
 
template<typename Dest , typename Conv , typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
Dest structure_cast (fcppt::math::matrix::object< T, R, C, S > const &src)
 Converts a matrix into a different matrix of the same dimension using Conv.
 
template<typename T , typename S1 , typename S2 >
fcppt::math::vector::static_< T, 3 > transform_direction (fcppt::math::matrix::object< T, 4, 4, S1 > const &_matrix, fcppt::math::vector::object< T, 3, S2 > const &_vector)
 Multiplies a 4x4 matrix by a 3D vector, adding 0 for w, returns a 3D vector.
 
template<typename T , typename S1 , typename S2 >
fcppt::math::vector::static_< T, 3 > transform_point (fcppt::math::matrix::object< T, 4, 4, S1 > const &_matrix, fcppt::math::vector::object< T, 3, S2 > const &_vector)
 Multiplies a 4x4 matrix by a 3D vector, adding 1 for w, returns a 3D vector.
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > translation (T const _x, T const _y, T const _z)
 Calculates a 4x4 translation matrix from three coordinates.
 
template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > translation (fcppt::math::vector::object< T, 3, S > const &_vec)
 Calculates a 4x4 translation matrix from a three-dimensional vector.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< T, C, Rtranspose (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Calculates a transposed matrix.
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, *, Right), Roperator* (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::vector::object< Right, C, S2 > const &_right)
 Multiplies a matrix by a vector.
 

Detailed Description

Contains fcppt::math::matrix::object matrix::object and helper functions, classes and types for it.

Function Documentation

◆ logarithm()

fcppt::math::matrix::static_< T, N, N > fcppt::math::matrix::logarithm ( fcppt::math::matrix::object< T, N, N, S A,
T const  e1,
T const  e2,
T const  e3 
)

◆ scaling()

template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::scaling ( fcppt::math::vector::object< T, 3, S > const _vec)
inline

Calculates a scaling matrix from a three dimensional vector.

◆ sqrt()

fcppt::math::matrix::static_< T, N, N > fcppt::math::matrix::sqrt ( fcppt::math::matrix::object< T, N, N, S > const _matrix,
T const  _epsilon 
)