4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
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()
{
// Will output: (1,0,0),(0,1,0),(0,0,1),
fcppt::math::int_range_count<int_matrix_3x3::rows()>{},
{ std::cout << fcppt::math::matrix::at_r<Row>(m) << ','; });
}

Identity

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

void identity()
{
std::cout << m << '\n';
}

Header files

Header file Description
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.
 
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.
 
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.
 

Functions

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, Nfcppt::math::matrix::adjugate (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, Cfcppt::math::matrix::operator+ (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, Cfcppt::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.
 
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, M2fcppt::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.
 
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, Cfcppt::math::matrix::operator* (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, Cfcppt::math::matrix::operator* (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 > > fcppt::math::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 > > > fcppt::math::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, Cfcppt::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.
 
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.
 
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.
 
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.
 
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 - 1Ufcppt::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.
 
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)
 Calculates the determinant of a matrix.
 
template<typename T , fcppt::math::size_type DN, typename S >
fcppt::math::matrix::static_< T, DN, DNfcppt::math::matrix::exponential_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< Matrixfcppt::math::matrix::identity ()
 Returns the identity matrix;.
 
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.
 
template<typename Matrix , typename Function >
Matrix fcppt::math::matrix::init (Function const &_function)
 Initializes a matrix.
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, Nfcppt::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.
 
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, Cfcppt::math::matrix::map (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 > & 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
 
template<typename T >
fcppt::math::matrix::static_< T, 2, 2 > fcppt::math::matrix::rotation_2d (T const _angle)
 Calculates a two dimensional rotation matrix.
 
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.
 
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.
 
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.
 
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.
 
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)> fcppt::math::matrix::row (Type &&_value, Args &&..._args)
 Creates a matrix row for initialization.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< T, C, Rfcppt::math::matrix::transpose (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), Rfcppt::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.
 

Typedef Documentation

◆ row_type

The type of matrix row.

◆ static_

using fcppt::math::matrix::static_ = typedef fcppt::math::matrix::object<T, R, C, fcppt::math::matrix::detail::static_storage<T, R, C> >

Typedef helper for static matrices.

Template Parameters
TThe 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>, Matrix::static_rows::value, Matrix::static_columns::value>

The static type of a matrix.

Function Documentation

◆ adjugate()

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

Calculates the adjugate matrix.

Template Parameters
TThe matrix's value_type
NThe matrix's row (and column!) dimension type
SThe matrix's storage type
Parameters
_matrixMust be a statically sized matrix
Warning
You should consider this a slow operation.

◆ at_r()

fcppt::container::to_reference_type< std::remove_reference_t< Matrix > > fcppt::math::matrix::at_r ( Matrix _value)
inline

Access a row using a compile-time constant.

Template Parameters
MatrixMust be an fcppt::math::matrix::object.

◆ at_r_c()

fcppt::container::to_reference_type< fcppt::container::to_reference_type< std::remove_reference_t< Matrix > > > fcppt::math::matrix::at_r_c ( Matrix _value)
inline

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

Template Parameters
MatrixMust be an fcppt::math::matrix::object.
RThe index of the row
CThe index of the column

◆ binary_map()

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 
)
inline

Maps over two matrixs.

◆ componentwise_equal()

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
_m1The first matrix
_m2The second matrix
_epsilonThe epsilon to compare with

◆ delete_row_and_column()

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.

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

◆ determinant()

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

Calculates the determinant of a matrix.

Parameters
_matrixThe matrix

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

See also
fcppt::math::matrix::delete_row_and_column.

◆ exponential_pade()

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.

◆ identity()

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

Returns the identity matrix;.

◆ infinity_norm()

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
MatrixMust be a matrix
FunctionMust be a polymorphic function of type Matrix::value_type (fcppt::math::matrix::index<R,C>)

◆ inverse()

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.

Warning
Consider this a slow operation

◆ map()

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 
)
inline

Maps over the elements of a matrix.

◆ operator!=()

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]

Multiplies two matrices.

◆ operator*() [2/4]

Multiplies a matrix by a scalar.

◆ operator*() [3/4]

Multiplies a matrix by a vector.

◆ operator*() [4/4]

Multiplies a matrix by a scalar.

◆ operator+()

Adds two matrices.

◆ operator-()

Subtracts one matrix from another.

◆ operator<<()

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 
)
inline

Outputs the matrix to a basic_ostream

Template Parameters
ChThe stream's character type
TraitsThe 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==()

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_< T, 2, 2 > fcppt::math::matrix::rotation_2d ( T const  _angle)

Calculates a two dimensional rotation matrix.

Template Parameters
TThe matrix's value_type
Parameters
_angleThe angle to rotate about

The resulting matrix will be a static one.

◆ rotation_axis()

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.

Template Parameters
TThe matrix's value_type
Parameters
_angleThe angle to rotate about
_vectorThe axis to rotate around

The resulting matrix will be static.

See also
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_< T, 4, 4 > fcppt::math::matrix::rotation_x ( T const  _angle)

Calculates a 4x4 rotation matrix around the x axis.

Template Parameters
TThe matrix's value_type
Parameters
_angleThe angle to rotate about

The resulting matrix will be static.

See also
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_< T, 4, 4 > fcppt::math::matrix::rotation_y ( T const  _angle)

Calculates a 4x4 rotation matrix around the y axis.

Template Parameters
TThe matrix's value_type
Parameters
_angleThe angle to rotate about

The resulting matrix will be static.

See also
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_< T, 4, 4 > fcppt::math::matrix::rotation_z ( T const  _angle)

Calculates a 4x4 rotation matrix around the z axis.

Template Parameters
TThe matrix's value_type
Parameters
_angleThe angle to rotate about

The resulting matrix will be static.

See also
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<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)> 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
_xScaling in x direction
_yScaling in y direction
_zScaling in z direction

◆ structure_cast()

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
DestThe destination matrix's value_type

◆ transform_direction()

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.

Parameters
_matrixA 4x4 matrix
_vectorA 3D vector
See also
fcppt::math::matrix::transform_point

◆ transform_point()

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.

Parameters
_matrixA 4x4 matrix
_vectorA 3D vector
See also
fcppt::math::matrix::transform_direction

◆ translation() [1/2]

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)
inline

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

Parameters
_vecA 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
_xThe x translation
_yThe y translation
_zThe z translation

◆ transpose()

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.