3.8.0 Freundlich's C++ toolkit
fcppt.math.matrix

## Description

A class representing static n times m-dimensional matrices.

# Motivation

Matrices are ubiquitous in mathematics and computer science. Often, matrices represent linear operations and are applied to accordingly-sized vectors.

# Constructor

A matrix can be constructed using a variadic constructor which takes the matrix components in row-major order. This way, you can arrange the matrix's components nicely in the source code, as seen in the following example:

void ctor()
{
int_matrix_2x3 const m(fcppt::math::matrix::row(1, 2, 3), fcppt::math::matrix::row(4, 5, 6));
// Will print: ((1,2,3),(4,5,6))
std::cout << m << '\n';
}

# Operators

Matrix defines addition, subtraction, multiplication, scalar multiplication and multiplication by a vector.

Multiplication of two matrices is special: An `M1` by `N` matrix multiplied by an `N` by `M2` matrix results in an `M1` by `M2` matrix.

void multiply()
{
fcppt::math::matrix::row(10, 11, 12)));
std::cout << result << '\n';
}

Matrices can also be multiplied by a vector: An `R` by `C` matrix multiplied by a `C` vector yields an `R` vector. This operation is defined in `fcppt/math/matrix/vector.hpp`.

void vector_multiply()
{
std::cout << result << '\n';
}

# Representation

The matrix's internal representation is row-major, which means that a row is represented as a contiguous chunk of memory. Consequently, `operator[]` takes the row number and returns a row, which is represented as an fcppt::math::vector::object using a view as storage type. Here is an example:

void row_iterate()
{
auto const m(fcppt::math::matrix::identity<int_matrix_3x3>());
// Will output: (1,0,0),(0,1,0),(0,0,1),
fcppt::math::int_range_count<int_matrix_3x3::rows()>{}, [&m](auto const _row) {
FCPPT_USE(_row);
using row = fcppt::tag_type<decltype(_row)>;
std::cout << fcppt::math::matrix::at_r<row::value>(m) << ",";
});
}

# Identity

To get the identity matrix, use the fcppt::math::matrix::identity function:

void identity()
{
auto const m(fcppt::math::matrix::identity<int_matrix_3x3>());
std::cout << m << '\n';
}

`object_fwd.hpp` Contains fcppt::math::matrix::object's declaration.
`object_decl.hpp` Contains fcppt::math::matrix::object's definition.
`object_impl.hpp` Contains the definition of fcppt::math::matrix::object's member functions.
`object.hpp` Includes `object_fwd.hpp`, `object_decl.hpp` and `object_impl.hpp`.
`arithmetic.hpp` Contains symmetric and scalar arithmetic operators.
`comparison.hpp` Contains all comparison operators.
`output.hpp` Contains `operator<<`.
`vector.hpp` Contains `operator*` for fcppt::math::vector::object.

## Classes

struct  fcppt::math::matrix::has_dim< Matrix, R, C >
Metafunction to check if a static matrix has the specified dimensions. More...

struct  fcppt::math::matrix::index< Row, Column >
A static matrix index. More...

struct  fcppt::math::matrix::is_matrix< T >
Metafunction to test if a type is a matrix type. More...

class  fcppt::math::matrix::object< T, R, C, S >
A class representing a static matrix. More...

## Typedefs

template<typename T , fcppt::math::size_type C>
using fcppt::math::matrix::row_type = fcppt::math::vector::static_< T, C >
The type of matrix row. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C>
using fcppt::math::matrix::static_ = fcppt::math::matrix::object< T, R, C, fcppt::math::matrix::detail::static_storage< T, R, C > >
Typedef helper for static matrices. More...

template<typename Matrix >
using fcppt::math::matrix::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. More...

## Functions

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N > fcppt::math::matrix::adjugate (fcppt::math::matrix::object< T, N, N, S > const &_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, C > fcppt::math::matrix::operator+ (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::matrix::object< Right, R, C, S2 > const &_right)

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, C > fcppt::math::matrix::operator- (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. More...

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, M2 > fcppt::math::matrix::operator* (fcppt::math::matrix::object< L, M1, N, S1 > const &_left, fcppt::math::matrix::object< R, N, M2, S2 > const &_right)
Multiplies two matrices. More...

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, C > fcppt::math::matrix::operator* (fcppt::math::matrix::object< Left, R, C, S > const &_left, Right const &_right)
Multiplies a matrix by a scalar. More...

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, C > fcppt::math::matrix::operator* (Left const &_left, fcppt::math::matrix::object< Right, R, C, S > const &_right)
Multiplies a matrix by a scalar. More...

template<fcppt::math::size_type Index, typename Matrix >
fcppt::container::to_reference_type< std::remove_reference_t< Matrix > > fcppt::math::matrix::at_r (Matrix &_value)
Access a row using a compile-time constant. More...

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 > > > fcppt::math::matrix::at_r_c (Matrix &_value)
Access an element using compile-time constants for both row and column. More...

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, C > fcppt::math::matrix::binary_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. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool fcppt::math::matrix::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. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool fcppt::math::matrix::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. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool fcppt::math::matrix::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. More...

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 - 1U > fcppt::math::matrix::delete_row_and_column (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
Deletes a specific row and rolumn (a cross) from the matrix. More...

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::determinant (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
Calculates the determinant of a matrix. More...

template<typename T , fcppt::math::size_type DN, typename S >
fcppt::math::matrix::static_< T, DN, DN > fcppt::math::matrix::exponential_pade (fcppt::math::matrix::object< T, DN, DN, S > const &_matrix)
Calculates the matrix exponential e^A using a Pade approximation. More...

template<typename Matrix >
fcppt::math::matrix::to_static< Matrix > fcppt::math::matrix::identity ()
Returns the identity matrix;. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::infinity_norm (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
Calculates the infinity norm. More...

template<typename Matrix , typename Function >
Matrix fcppt::math::matrix::init (Function const &_function)
Initializes a matrix. More...

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N > fcppt::math::matrix::inverse (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
Calculates the inverse matrix, uses fcppt::math::matrix::adjugate and fcppt::math::matrix::determinant. More...

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, C > fcppt::math::matrix::map (fcppt::math::matrix::object< T, R, C, S > const &_value, Function const &_function)
Maps over the elements of a matrix. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Ch , typename Traits >
std::basic_ostream< Ch, Traits > & fcppt::math::matrix::operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::math::matrix::object< T, R, C, S > const &_matrix)
Outputs the matrix to a `basic_ostream` More...

template<typename T >
fcppt::math::matrix::static_< T, 2, 2 > fcppt::math::matrix::rotation_2d (T const _angle)
Calculates a two dimensional rotation matrix. More...

template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::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. More...

template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::rotation_x (T const _angle)
Calculates a 4x4 rotation matrix around the x axis. More...

template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::rotation_y (T const _angle)
Calculates a 4x4 rotation matrix around the y axis. More...

template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::rotation_z (T const _angle)
Calculates a 4x4 rotation matrix around the z axis. More...

template<typename Type , typename... Args, typename = std::enable_if_t<std::conjunction_v<std::is_same< fcppt::type_traits::remove_cv_ref_t<Args>, fcppt::type_traits::remove_cv_ref_t<Type>>...>>>
fcppt::math::matrix::row_type< fcppt::type_traits::remove_cv_ref_t< Type >, fcppt::cast::size< fcppt::math::size_type >sizeof...(Args)+1U)> fcppt::math::matrix::row (Type &&_value, Args &&..._args)
Creates a matrix row for initialization. More...

template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::scaling (T const _x, T const _y, T const _z)
Calculates a 4x4 scaling matrix. More...

template<typename Dest , typename Conv , typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
Dest fcppt::math::matrix::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. More...

template<typename T , typename S1 , typename S2 >
fcppt::math::vector::static_< T, 3 > fcppt::math::matrix::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. More...

template<typename T , typename S1 , typename S2 >
fcppt::math::vector::static_< T, 3 > fcppt::math::matrix::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. More...

template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::translation (T const _x, T const _y, T const _z)
Calculates a 4x4 translation matrix from three coordinates. More...

template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > fcppt::math::matrix::translation (fcppt::math::vector::object< T, 3, S > const &_vec)
Calculates a 4x4 translation matrix from a three-dimensional vector. More...

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< T, C, R > fcppt::math::matrix::transpose (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
Calculates a transposed matrix. More...

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), R > fcppt::math::matrix::operator* (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. More...

## ◆ row_type

template<typename T , fcppt::math::size_type C>
 using fcppt::math::matrix::row_type = typedef fcppt::math::vector::static_

The type of matrix row.

## ◆ static_

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C>
 using fcppt::math::matrix::static_ = typedef fcppt::math::matrix::object >

Typedef helper for static matrices.

Template Parameters
 T The matrix's `value_type`

## ◆ to_static

template<typename Matrix >
 using fcppt::math::matrix::to_static = typedef fcppt::math::matrix::static_< fcppt::type_traits::value_type, Matrix::static_rows::value, Matrix::static_columns::value>

The static type of a matrix.

## Function Documentation

template<typename T , fcppt::math::size_type N, typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::adjugate ( fcppt::math::matrix::object< T, N, N, S > const & _matrix )

Template Parameters
 T The matrix's `value_type` N The matrix's row (and column!) dimension type S The matrix's storage type
Parameters
 _matrix Must be a statically sized matrix
Warning
You should consider this a slow operation.

## ◆ at_r()

template<fcppt::math::size_type Index, typename Matrix >
 fcppt::container::to_reference_type > fcppt::math::matrix::at_r ( Matrix & _value )
inline

Access a row using a compile-time constant.

Template Parameters
 Matrix Must be an fcppt::math::matrix::object.

## ◆ at_r_c()

template<fcppt::math::size_type R, fcppt::math::size_type C, typename Matrix >
 fcppt::container::to_reference_type< fcppt::container::to_reference_type > > fcppt::math::matrix::at_r_c ( Matrix & _value )
inline

Access an element using compile-time constants for both row and column.

Template Parameters
 Matrix Must be an fcppt::math::matrix::object. R The index of the row C The index of the column

## ◆ binary_map()

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_, R, C> fcppt::math::matrix::binary_map ( fcppt::math::matrix::object< T1, R, C, S1 > const & _left, fcppt::math::matrix::object< T2, R, C, S2 > const & _right, Function const & _function )
inline

Maps over two matrixs.

## ◆ componentwise_equal()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
 bool fcppt::math::matrix::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 )
inline

Compares two floating point matrices componentwise using an epsilon.

Parameters
 _m1 The first matrix _m2 The second matrix _epsilon The epsilon to compare with

## ◆ delete_row_and_column()

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_ fcppt::math::matrix::delete_row_and_column ( fcppt::math::matrix::object< T, R, C, S > const & _matrix )

Deletes a specific row and rolumn (a cross) from the matrix.

Returns
The result type will be `(N - 1, M - 1)`
Template Parameters
 DR The index of the row to delete DC The index of the column to delete

## ◆ determinant()

template<typename T , fcppt::math::size_type N, typename S >
 T fcppt::math::matrix::determinant ( fcppt::math::matrix::object< T, N, N, S > const & _matrix )
inline

Calculates the determinant of a matrix.

Parameters
 _matrix The matrix

This function uses the Laplace extension. Consider it slow (very slow!).

fcppt::math::matrix::delete_row_and_column.

template<typename T , fcppt::math::size_type DN, typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::exponential_pade ( fcppt::math::matrix::object< T, DN, DN, S > const & _matrix )

Calculates the matrix exponential e^A using a Pade approximation.

## ◆ identity()

template<typename Matrix >
 fcppt::math::matrix::to_static fcppt::math::matrix::identity ( )

Returns the identity matrix;.

## ◆ infinity_norm()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
 T fcppt::math::matrix::infinity_norm ( fcppt::math::matrix::object< T, R, C, S > const & _matrix )

Calculates the infinity norm.

## ◆ init()

template<typename Matrix , typename Function >
 Matrix fcppt::math::matrix::init ( Function const & _function )
inline

Initializes a matrix.

Calls `_function` for every index of the matrix.

Template Parameters
 Matrix Must be a matrix Function Must be a polymorphic function of type `Matrix::value_type (fcppt::math::matrix::index)`

## ◆ inverse()

template<typename T , fcppt::math::size_type N, typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::inverse ( fcppt::math::matrix::object< T, N, N, S > const & _matrix )

Calculates the inverse matrix, uses fcppt::math::matrix::adjugate and fcppt::math::matrix::determinant.

Warning
Consider this a slow operation

## ◆ map()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Function >
 fcppt::math::matrix::static_, R, C> fcppt::math::matrix::map ( fcppt::math::matrix::object< T, R, C, S > const & _value, Function const & _function )
inline

Maps over the elements of a matrix.

## ◆ operator!=()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
 bool fcppt::math::matrix::operator!= ( fcppt::math::matrix::object< T, R, C, S1 > const & _m1, fcppt::math::matrix::object< T, R, C, S2 > const & _m2 )
inline

Compares two matrices component-wise.

Warning
This uses `T`'s inequality comparison operator, so be careful if you want to compare floating point matrices.

## ◆ operator*() [1/4]

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::matrix::operator* ( fcppt::math::matrix::object< L, M1, N, S1 > const & _left, fcppt::math::matrix::object< R, N, M2, S2 > const & _right )
inline

Multiplies two matrices.

## ◆ operator*() [2/4]

template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::operator* ( fcppt::math::matrix::object< Left, R, C, S > const & _left, Right const & _right )
inline

Multiplies a matrix by a scalar.

## ◆ operator*() [3/4]

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::matrix::operator* ( 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.

## ◆ operator*() [4/4]

template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::operator* ( Left const & _left, fcppt::math::matrix::object< Right, R, C, S > const & _right )
inline

Multiplies a matrix by a scalar.

## ◆ operator+()

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::matrix::operator+ ( fcppt::math::matrix::object< Left, R, C, S1 > const & _left, fcppt::math::matrix::object< Right, R, C, S2 > const & _right )
inline

## ◆ operator-()

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::matrix::operator- ( fcppt::math::matrix::object< Left, R, C, S1 > const & _left, fcppt::math::matrix::object< Right, R, C, S2 > const & _right )
inline

Subtracts one matrix from another.

## ◆ operator<<()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Ch , typename Traits >
 std::basic_ostream& fcppt::math::matrix::operator<< ( std::basic_ostream< Ch, Traits > & _stream, fcppt::math::matrix::object< T, R, C, S > const & _matrix )
inline

Outputs the matrix to a `basic_ostream`

Template Parameters
 Ch The stream's character type Traits The stream's character traits type

The format will contain no new-lines and will be of the form:

```((a,b,c,...),(d,e,f,...),...,...)
```

So it'll be the same as if you output the column vectors using the according `operator<<`.

## ◆ operator==()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
 bool fcppt::math::matrix::operator== ( fcppt::math::matrix::object< T, R, C, S1 > const & _m1, fcppt::math::matrix::object< T, R, C, S2 > const & _m2 )
inline

Compares two matrices component-wise.

Warning
This uses `T`'s equality comparison operator, so be careful if you want to compare floating point matrices.

## ◆ rotation_2d()

template<typename T >
 fcppt::math::matrix::static_ fcppt::math::matrix::rotation_2d ( T const _angle )

Calculates a two dimensional rotation matrix.

Template Parameters
 T The matrix's `value_type`
Parameters
 _angle The angle to rotate about

The resulting matrix will be a static one.

## ◆ rotation_axis()

template<typename T , typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::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 Parameters
 T The matrix's `value_type`
Parameters
 _angle The angle to rotate about _vector The axis to rotate around

The resulting matrix will be static.

fcppt::math::matrix::rotation_x
fcppt::math::matrix::rotation_y
fcppt::math::matrix::rotation_z
fcppt::math::matrix::rotation_axis

## ◆ rotation_x()

template<typename T >
 fcppt::math::matrix::static_ fcppt::math::matrix::rotation_x ( T const _angle )

Calculates a 4x4 rotation matrix around the x axis.

Template Parameters
 T The matrix's `value_type`
Parameters
 _angle The angle to rotate about

The resulting matrix will be static.

fcppt::math::matrix::rotation_x
fcppt::math::matrix::rotation_y
fcppt::math::matrix::rotation_z
fcppt::math::matrix::rotation_axis

## ◆ rotation_y()

template<typename T >
 fcppt::math::matrix::static_ fcppt::math::matrix::rotation_y ( T const _angle )

Calculates a 4x4 rotation matrix around the y axis.

Template Parameters
 T The matrix's `value_type`
Parameters
 _angle The angle to rotate about

The resulting matrix will be static.

fcppt::math::matrix::rotation_x
fcppt::math::matrix::rotation_y
fcppt::math::matrix::rotation_z
fcppt::math::matrix::rotation_axis

## ◆ rotation_z()

template<typename T >
 fcppt::math::matrix::static_ fcppt::math::matrix::rotation_z ( T const _angle )

Calculates a 4x4 rotation matrix around the z axis.

Template Parameters
 T The matrix's `value_type`
Parameters
 _angle The angle to rotate about

The resulting matrix will be static.

fcppt::math::matrix::rotation_x
fcppt::math::matrix::rotation_y
fcppt::math::matrix::rotation_z
fcppt::math::matrix::rotation_axis

## ◆ row()

template<typename Type , typename... Args, typename = std::enable_if_t<std::conjunction_v<std::is_same< fcppt::type_traits::remove_cv_ref_t<Args>, fcppt::type_traits::remove_cv_ref_t<Type>>...>>>
 fcppt::math::matrix::row_type< fcppt::type_traits::remove_cv_ref_t, fcppt::cast::sizesizeof...(Args) + 1U)> fcppt::math::matrix::row ( Type && _value, Args &&... _args )
inline

Creates a matrix row for initialization.

## ◆ scaling()

template<typename T >
 fcppt::math::matrix::static_< T, 4, 4> fcppt::math::matrix::scaling ( T const _x, T const _y, T const _z )

Calculates a 4x4 scaling matrix.

Parameters
 _x Scaling in x direction _y Scaling in y direction _z Scaling in z direction

## ◆ structure_cast()

template<typename Dest , typename Conv , typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
 Dest fcppt::math::matrix::structure_cast ( fcppt::math::matrix::object< T, R, C, S > const & src )
inline

Converts a matrix into a different matrix of the same dimension using Conv.

Template Parameters
 Dest The destination matrix's `value_type`

## ◆ transform_direction()

template<typename T , typename S1 , typename S2 >
 fcppt::math::vector::static_ fcppt::math::matrix::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.

Parameters
 _matrix A 4x4 matrix _vector A 3D vector
fcppt::math::matrix::transform_point

## ◆ transform_point()

template<typename T , typename S1 , typename S2 >
 fcppt::math::vector::static_ fcppt::math::matrix::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.

Parameters
 _matrix A 4x4 matrix _vector A 3D vector
fcppt::math::matrix::transform_direction

## ◆ translation() [1/2]

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

Calculates a 4x4 translation matrix from a three-dimensional vector.

Parameters
 _vec A three-dimensional vector

## ◆ translation() [2/2]

template<typename T >
 fcppt::math::matrix::static_< T, 4, 4> fcppt::math::matrix::translation ( T const _x, T const _y, T const _z )

Calculates a 4x4 translation matrix from three coordinates.

Parameters
 _x The x translation _y The y translation _z The z translation

## ◆ transpose()

template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
 fcppt::math::matrix::static_ fcppt::math::matrix::transpose ( fcppt::math::matrix::object< T, R, C, S > const & _matrix )

Calculates a transposed matrix.