NRE::Math::Matrix4x4< T > Class Template Reference

4x4 generic matrix More...

#include <NRE_Matrix4x4.hpp>

Inheritance diagram for NRE::Math::Matrix4x4< T >:

Public Member Functions

constexpr Matrix4x4 ()=default
 
template<class A , class B , class C , class D , class E , class F , class G , class H , class I , class J , class K , class L , class M , class N , class O , class P >
constexpr Matrix4x4 (A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p)
 
template<class K >
constexpr Matrix4x4 (K value)
 
template<class K , class L , class N , class M >
constexpr Matrix4x4 (Vector4D< K > const &l1, Vector4D< L > const &l2, Vector4D< N > const &l3, Vector4D< M > const &l4)
 
constexpr Matrix4x4 (Matrix4x4 const &m)=default
 
constexpr Matrix4x4 (Matrix4x4 &&m)=default
 
template<class K >
constexpr Matrix4x4 (Matrix3x3< K > const &m)
 
template<class K >
constexpr Matrix4x4 (Matrix4x4< K > const &m)
 
template<class K >
constexpr Matrix4x4 (Quaternion< K > const &q)
 
 ~Matrix4x4 ()=default
 
constexpr Vector4D< T > const & getL1 () const
 
constexpr Vector4D< T > const & getL2 () const
 
constexpr Vector4D< T > const & getL3 () const
 
constexpr Vector4D< T > const & getL4 () const
 
constexpr Vector4D< T > getC1 () const
 
constexpr Vector4D< T > getC2 () const
 
constexpr Vector4D< T > getC3 () const
 
constexpr Vector4D< T > getC4 () const
 
constexpr long double getDeterminant () const
 
template<class K >
constexpr void setL1 (Vector4D< K > const &l1)
 
template<class K >
constexpr void setL2 (Vector4D< K > const &l2)
 
template<class K >
constexpr void setL3 (Vector4D< K > const &l3)
 
template<class K >
constexpr void setL4 (Vector4D< K > const &l4)
 
template<class K >
constexpr void setC1 (Vector4D< K > const &c1)
 
template<class K >
constexpr void setC2 (Vector4D< K > const &c2)
 
template<class K >
constexpr void setC3 (Vector4D< K > const &c3)
 
template<class K >
constexpr void setC4 (Vector4D< K > const &c4)
 
constexpr Matrix4x4setIdentity ()
 
constexpr Matrix4x4transpose ()
 
constexpr Matrix4x4inverse ()
 
template<class K >
constexpr Matrix4x4translate (Vector3D< K > const &u)
 
template<class K >
constexpr Matrix4x4scale (Vector3D< K > const &u)
 
template<class K , typename = UseIfArithmetic<K>>
constexpr Matrix4x4stretchX (K u)
 
template<class K , typename = UseIfArithmetic<K>>
constexpr Matrix4x4stretchY (K u)
 
template<class K , typename = UseIfArithmetic<K>>
constexpr Matrix4x4stretchZ (K u)
 
template<class K >
constexpr Matrix4x4rotate (Angle angle, Vector3D< K > const &axis)
 
template<class K , class L , typename = UseIfArithmetic<K>>
constexpr Matrix4x4perspective (Angle fov, K ratio, Vector2D< L > const &z)
 
template<class K , class L , class N >
constexpr Matrix4x4ortho (Vector2D< K > const &h, Vector2D< L > const &v, Vector2D< N > const &z)
 
template<class K , class L >
constexpr Matrix4x4ortho2D (Vector2D< K > const &h, Vector2D< L > const &v)
 
template<class K , class L , class N >
constexpr Matrix4x4lookAt (Vector3D< K > const &eye, Vector3D< L > const &center, Vector3D< N > const &up)
 
constexpr const T * value () const
 
constexpr Vector4D< T > & operator[] (std::size_t index)
 
constexpr Vector4D< T > const & operator[] (std::size_t index) const
 
constexpr Matrix4x4operator= (Matrix4x4 const &m)=default
 
constexpr Matrix4x4operator= (Matrix4x4 &&m)=default
 
template<class K >
constexpr Matrix4x4operator= (Matrix4x4< K > const &m)
 
template<class K >
constexpr Matrix4x4operator= (Matrix4x4< K > &&m)
 
template<class K >
constexpr Matrix4x4operator+= (Matrix4x4< K > const &m)
 
template<class K >
constexpr Matrix4x4operator-= (Matrix4x4< K > const &m)
 
template<class K >
constexpr Matrix4x4operator*= (K k)
 
template<class K >
constexpr Matrix4x4operator*= (Matrix4x4< K > const &m)
 
template<class K >
constexpr Matrix4x4operator/= (K k)
 
template<class K >
constexpr Matrix4x4operator/= (Matrix4x4< K > const &m)
 
template<class K >
constexpr Matrix4x4< std::common_type_t< T, K > > operator+ (Matrix4x4< K > const &m) const
 
template<class K >
constexpr Matrix4x4< std::common_type_t< T, K > > operator- (Matrix4x4< K > const &m) const
 
template<class K >
constexpr Matrix4x4< std::common_type_t< T, K > > operator* (K k) const
 
template<class K >
constexpr Matrix4x4< std::common_type_t< T, K > > operator* (Matrix4x4< K > const &m) const
 
template<class K >
constexpr Vector4D< K > operator* (Vector4D< K > const &u) const
 
template<class K >
constexpr Segment4D< K > operator* (Segment4D< K > const &s) const
 
constexpr BezierCurve4D operator* (BezierCurve4D const &c) const
 
template<class K >
constexpr Matrix4x4< std::common_type_t< T, K > > operator/ (K k) const
 
template<class K >
constexpr Matrix4x4< std::common_type_t< T, K > > operator/ (Matrix4x4< K > const &m) const
 
template<class K >
constexpr bool operator== (Matrix4x4< K > const &m) const
 
template<class K >
constexpr bool operator!= (Matrix4x4< K > const &m) const
 
Utility::String toString () const
 

Static Public Attributes

static constexpr Matrix4x4 IDENTITY = Matrix4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
 

Detailed Description

template<class T>
class NRE::Math::Matrix4x4< T >

4x4 generic matrix

Constructor & Destructor Documentation

template<class T>
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( )
default

Default constructor

template<class T>
template<class A , class B , class C , class D , class E , class F , class G , class H , class I , class J , class K , class L , class M , class N , class O , class P >
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p 
)

Construct a matrix with passed values

Parameters
afirst matrix component
bsecond matrix component
cthird matrix component
dfourth matrix component
efifth matrix component
fsixth matrix component
gseventh matrix component
heighth matrix component
ininth matrix component
jtenth matrix component
keleventh matrix component
ltwelfth matrix component
mthirteenth matrix component
nfourteenth matrix component
ofifteenth matrix component
psixteenth matrix component
template<class T>
template<class K >
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( value)

Construct a matrix with a unique value for all component

Parameters
valuenew value for all component
template<class T>
template<class K , class L , class N , class M >
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( Vector4D< K > const &  l1,
Vector4D< L > const &  l2,
Vector4D< N > const &  l3,
Vector4D< M > const &  l4 
)

Construct a matrix with their lines passed in parameters with vector

Parameters
l1the new value for the first line
l2the new value for the second line
l3the new value for the third line
l4the new value for the fourth line
template<class T>
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( Matrix4x4< T > const &  m)
default

Copy m into this

Parameters
mthe object to copy
template<class T>
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( Matrix4x4< T > &&  m)
default

Move m into this

Parameters
mthe object to move
template<class T>
template<class K >
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( Matrix3x3< K > const &  m)

Convert a K-type 3x3 matrix into a T-type 4x4 matrix

Parameters
mthe K-type 3x3 matrix to convert
template<class T>
template<class K >
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( Matrix4x4< K > const &  m)

Convert a K-type matrix into a T-type matrix

Parameters
mthe K-type matrix to convert
template<class T>
template<class K >
constexpr NRE::Math::Matrix4x4< T >::Matrix4x4 ( Quaternion< K > const &  q)

Convert a K-type quaternion into a T-type matrix

Parameters
qthe K-type quaternion to convert
template<class T>
NRE::Math::Matrix4x4< T >::~Matrix4x4 ( )
default

Matrix4x4 Deconstructor

Member Function Documentation

template<class T>
constexpr Vector4D<T> NRE::Math::Matrix4x4< T >::getC1 ( ) const
Returns
the first column
template<class T>
constexpr Vector4D<T> NRE::Math::Matrix4x4< T >::getC2 ( ) const
Returns
the second column
template<class T>
constexpr Vector4D<T> NRE::Math::Matrix4x4< T >::getC3 ( ) const
Returns
the third column
template<class T>
constexpr Vector4D<T> NRE::Math::Matrix4x4< T >::getC4 ( ) const
Returns
the fourth column
template<class T>
constexpr long double NRE::Math::Matrix4x4< T >::getDeterminant ( ) const
Returns
the matrix's determinant
template<class T>
constexpr Vector4D<T> const& NRE::Math::Matrix4x4< T >::getL1 ( ) const
Returns
the first line
template<class T>
constexpr Vector4D<T> const& NRE::Math::Matrix4x4< T >::getL2 ( ) const
Returns
the second line
template<class T>
constexpr Vector4D<T> const& NRE::Math::Matrix4x4< T >::getL3 ( ) const
Returns
the third line
template<class T>
constexpr Vector4D<T> const& NRE::Math::Matrix4x4< T >::getL4 ( ) const
Returns
the fourth line
template<class T>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::inverse ( )

Inverse the matrix, if not possible the matrix become the identity one

Returns
the reference of himself
template<class T>
template<class K , class L , class N >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::lookAt ( Vector3D< K > const &  eye,
Vector3D< L > const &  center,
Vector3D< N > const &  up 
)

Perform a viewing transformation on this

Parameters
eyethe camera's eye
centerthe point fixed by the camera
upthe camera's up vector
Returns
the reference of himself
template<class T>
template<class K >
constexpr bool NRE::Math::Matrix4x4< T >::operator!= ( Matrix4x4< K > const &  m) const

Difference test between this and m

Parameters
mthe matrix to test with this
Returns
the test's result
template<class T>
template<class K >
constexpr Matrix4x4<std::common_type_t<T, K> > NRE::Math::Matrix4x4< T >::operator* ( k) const

Compute the matrix resulting in the multiplication of this by k

Parameters
kthe multiplication factor
Returns
the newly computed matrix
template<class T>
template<class K >
constexpr Matrix4x4<std::common_type_t<T, K> > NRE::Math::Matrix4x4< T >::operator* ( Matrix4x4< K > const &  m) const

Compute the matrix resulting in the multiplication of this and m

Parameters
mthe matrix to multiply with this
Returns
the newly computed matrix
template<class T>
template<class K >
constexpr Vector4D<K> NRE::Math::Matrix4x4< T >::operator* ( Vector4D< K > const &  u) const

Compute the vector resulting in the transformation of u by this

Parameters
uthe vector to transform
Returns
the newly computed vector
template<class T>
template<class K >
constexpr Segment4D<K> NRE::Math::Matrix4x4< T >::operator* ( Segment4D< K > const &  s) const

Compute the segment resulting in the transformation of s by this

Parameters
sthe segment to transform
Returns
the newly computed vector
template<class T>
constexpr BezierCurve4D NRE::Math::Matrix4x4< T >::operator* ( BezierCurve4D const &  c) const

Compute the bezier curve resulting in the transformation of c by this

Parameters
cthe bezier curve to transform
Returns
the newly computed vector
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator*= ( k)

Multiply this by k

Parameters
kthe multiplication factor
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator*= ( Matrix4x4< K > const &  m)

Multiply this with m

Parameters
mthe matrix to multiply with this
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4<std::common_type_t<T, K> > NRE::Math::Matrix4x4< T >::operator+ ( Matrix4x4< K > const &  m) const

Compute the matrix resulting in the addition of this and m

Parameters
mthe matrix to add with this
Returns
the newly computed matrix
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator+= ( Matrix4x4< K > const &  m)

Add m into this

Parameters
mthe matrix to add into this
Returns
the reference on himself
template<class T>
template<class K >
constexpr Matrix4x4<std::common_type_t<T, K> > NRE::Math::Matrix4x4< T >::operator- ( Matrix4x4< K > const &  m) const

Compute the matrix resulting in the subtraction of this and m

Parameters
mthe matrix to subtract with this
Returns
the newly computed matrix
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator-= ( Matrix4x4< K > const &  m)

Subtract m into this

Parameters
mthe matrix to subtract into this
Returns
the reference on himself
template<class T>
template<class K >
constexpr Matrix4x4<std::common_type_t<T, K> > NRE::Math::Matrix4x4< T >::operator/ ( k) const

Compute the matrix resulting in the division of this by k

Parameters
kthe division factor
Returns
the newly computed matrix
template<class T>
template<class K >
constexpr Matrix4x4<std::common_type_t<T, K> > NRE::Math::Matrix4x4< T >::operator/ ( Matrix4x4< K > const &  m) const

Compute the matrix resulting in the division of this and m

Parameters
mthe matrix to divide with this
Returns
the newly computed matrix
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator/= ( k)

Divide this by k

Parameters
kthe division factor
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator/= ( Matrix4x4< K > const &  m)

Divide this with m

Parameters
mthe matrix to divide with this
Returns
the reference of himself
template<class T>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator= ( Matrix4x4< T > const &  m)
default

Copy m into this

Parameters
mthe object to copy into this
Returns
the reference of himself
template<class T>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator= ( Matrix4x4< T > &&  m)
default

Move m into this

Parameters
mthe object to move into this
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator= ( Matrix4x4< K > const &  m)

Copy m into this

Parameters
mthe object to copy into this
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::operator= ( Matrix4x4< K > &&  m)

Move m into this

Parameters
mthe object to move into this
Returns
the reference of himself
template<class T>
template<class K >
constexpr bool NRE::Math::Matrix4x4< T >::operator== ( Matrix4x4< K > const &  m) const

Equality test between this and m

Parameters
mthe matrix to test with this
Returns
the test's result
template<class T>
constexpr Vector4D<T>& NRE::Math::Matrix4x4< T >::operator[] ( std::size_t  index)

Return a reference on a matrix's line

Warning
No range check performed
Parameters
indexthe line's index
Returns
the line's reference
template<class T>
constexpr Vector4D<T> const& NRE::Math::Matrix4x4< T >::operator[] ( std::size_t  index) const

Return a const reference on a matrix's line

Warning
No range check performed
Parameters
indexthe line's index
Returns
the line's reference
template<class T>
template<class K , class L , class N >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::ortho ( Vector2D< K > const &  h,
Vector2D< L > const &  v,
Vector2D< N > const &  z 
)

Perform an orthogonal projection on this

Parameters
hthe horizontal clipping plane
vthe vertical clipping plane
zthe projection's plane distance
Returns
the reference of himself
template<class T>
template<class K , class L >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::ortho2D ( Vector2D< K > const &  h,
Vector2D< L > const &  v 
)

Perform a 2D orthogonal projection on this

Parameters
hthe horizontal clipping plane
vthe vertical clipping plane
Returns
the reference of himself
template<class T>
template<class K , class L , typename = UseIfArithmetic<K>>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::perspective ( Angle  fov,
ratio,
Vector2D< L > const &  z 
)
inline

Perform a perspective projection on this

Parameters
fovthe projection's fov
ratiothe projection's ratio
zthe projection's plane distance
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::rotate ( Angle  angle,
Vector3D< K > const &  axis 
)

Add a rotation

Parameters
anglethe rotation's angle
axisthe rotation's axis
Returns
the reference of himself
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::scale ( Vector3D< K > const &  u)

Add a scale

Parameters
uthe scaling vector
Returns
the reference of himself
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setC1 ( Vector4D< K > const &  c1)

First column setter

Parameters
c1the new first column vector
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setC2 ( Vector4D< K > const &  c2)

Second column setter

Parameters
c2the new second column vector
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setC3 ( Vector4D< K > const &  c3)

Third column setter

Parameters
c3the new third column vector
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setC4 ( Vector4D< K > const &  c4)

Fourth column setter

Parameters
c4the new fourth column vector
template<class T>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::setIdentity ( )

Set the matrix to the identity matrix

Returns
the reference of himself
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setL1 ( Vector4D< K > const &  l1)

First line setter

Parameters
l1the new first line vector
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setL2 ( Vector4D< K > const &  l2)

Second line setter

Parameters
l2the new second line vector
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setL3 ( Vector4D< K > const &  l3)

Third line setter

Parameters
l3the new third line vector
template<class T>
template<class K >
constexpr void NRE::Math::Matrix4x4< T >::setL4 ( Vector4D< K > const &  l4)

Fourth line setter

Parameters
l4the new fourth line vector
template<class T>
template<class K , typename = UseIfArithmetic<K>>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::stretchX ( u)
inline

Add a stretch on the X axis

Parameters
uthe stretch factor
Returns
the reference of himself
template<class T>
template<class K , typename = UseIfArithmetic<K>>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::stretchY ( u)
inline

Add a stretch on the Y axis

Parameters
uthe stretch factor
Returns
the reference of himself
template<class T>
template<class K , typename = UseIfArithmetic<K>>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::stretchZ ( u)
inline

Add a stretch on the Z axis

Parameters
uthe stretch factor
Returns
the reference of himself
template<class T>
Utility::String NRE::Math::Matrix4x4< T >::toString ( ) const

Convert the 4x4 matrix into a string

Returns
the converted 4x4 matrix
template<class T>
template<class K >
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::translate ( Vector3D< K > const &  u)

Add a translation

Parameters
uthe translation vector
Returns
the reference of himself
template<class T>
constexpr Matrix4x4& NRE::Math::Matrix4x4< T >::transpose ( )

Transpose the matrix

Returns
the reference of himself
template<class T>
constexpr const T* NRE::Math::Matrix4x4< T >::value ( ) const
Returns
a pointer to the vector's data

Member Data Documentation

template<class T>
constexpr Matrix4x4 NRE::Math::Matrix4x4< T >::IDENTITY = Matrix4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
static

Identity matrix


The documentation for this class was generated from the following files: