philsupertramp/game-math
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
mat4< T > Struct Template Reference

#include <mat4.h>

Public Member Functions

 mat4 ()
 
 mat4 (const T &_a, const T &_b, const T &_c, const T &_d, const T &_e, const T &_f, const T &_g, const T &_h, const T &_i, const T &_j, const T &_k, const T &_l, const T &_m, const T &_n, const T &_o, const T &_p)
 
 mat4 (const vec4< T > &A, const vec4< T > &B, const vec4< T > &C, const vec4< T > &D)
 
 mat4 (const T &_a)
 
 ~mat4 ()=default
 
mat4< T > Transpose ()
 
bool IsSymmetric ()
 
float Determinant ()
 
mat3< T > getMinor (const size_t &i, const size_t &j)
 
mat4 Inverse ()
 
mat4< T > & operator+= (const mat4< T > &rhs)
 
mat4< T > & operator-= (const mat4< T > &rhs)
 
mat4< T > & operator*= (const mat4< T > &rhs)
 
mat4< T > & operator*= (const T &rhs)
 
mat4< T > & operator/= (const T &rhs)
 
bool operator== (const mat4< T > &rhs)
 
bool operator!= (const mat4< T > &rhs)
 
T * operator[] (int index)
 
const T * operator[] (int index) const
 

Static Public Member Functions

static mat4< T > Unit ()
 
static mat4< T > Transformation (const mat3< T > &m)
 

Public Attributes

values [4][4]
 loosely packed data More...
 

Friends

mat4< T > operator+ (mat4< T > lhs, const mat4< T > &rhs)
 
mat4< T > operator- (mat4< T > lhs, const mat4< T > &rhs)
 
mat4< T > operator* (mat4< T > lhs, const T &rhs)
 
vec4< T > operator* (mat4< T > lhs, const vec4< T > &rhs)
 
mat4< T > operator* (mat4< T > lhs, const mat4< T > &rhs)
 
mat4< T > operator/ (mat4< T > lhs, const T &rhs)
 
template<class U >
std::ostream & operator<< (std::ostream &, const mat4< U > &)
 

Detailed Description

template<class T>
struct mat4< T >

4D-matrix representation

Template Parameters
T
Examples
TestUtils.cpp, and mat/TestMat4.cpp.

Constructor & Destructor Documentation

◆ mat4() [1/4]

template<class T >
mat4< T >::mat4 ( )
inline

default constructor

◆ mat4() [2/4]

template<class T >
mat4< T >::mat4 ( const T &  _a,
const T &  _b,
const T &  _c,
const T &  _d,
const T &  _e,
const T &  _f,
const T &  _g,
const T &  _h,
const T &  _i,
const T &  _j,
const T &  _k,
const T &  _l,
const T &  _m,
const T &  _n,
const T &  _o,
const T &  _p 
)
inline

16-element constructor

Parameters
_a
_b
_c
_d
_e
_f
_g
_h
_i
_j
_k
_l
_m
_n
_o
_p

◆ mat4() [3/4]

template<class T >
mat4< T >::mat4 ( const vec4< T > &  A,
const vec4< T > &  B,
const vec4< T > &  C,
const vec4< T > &  D 
)
inline

column-based constructor

Parameters
A
B
C
D

◆ mat4() [4/4]

template<class T >
mat4< T >::mat4 ( const T &  _a)
inlineexplicit

single-value constructor

Parameters
_a

◆ ~mat4()

template<class T >
mat4< T >::~mat4 ( )
default

default destructor

Member Function Documentation

◆ Determinant()

template<class T >
float mat4< T >::Determinant ( )
inline

computes determinant

Returns

◆ getMinor()

template<class T >
mat3< T > mat4< T >::getMinor ( const size_t &  i,
const size_t &  j 
)
inline

Get minor matrix by exclusion indices

Parameters
irow to exclude
jcolumn to exclude
Returns
values without row i and column j

◆ Inverse()

template<class T >
mat4 mat4< T >::Inverse ( )
inline

Calculate inverse matrix

Returns
A -> A^-1
Examples
mat/TestMat4.cpp.

◆ IsSymmetric()

template<class T >
bool mat4< T >::IsSymmetric ( )
inline

test whether matrix is symmetric

Returns
Examples
mat/TestMat4.cpp.

◆ operator!=()

template<class T >
bool mat4< T >::operator!= ( const mat4< T > &  rhs)
inline

not equal operator

Parameters
rhs
Returns

◆ operator*=() [1/2]

template<class T >
mat4< T > & mat4< T >::operator*= ( const mat4< T > &  rhs)
inline

matrix-matrix multiplication

Parameters
rhs
Returns

◆ operator*=() [2/2]

template<class T >
mat4< T > & mat4< T >::operator*= ( const T &  rhs)
inline

matrix-scalar multiplication

Parameters
rhs
Returns

◆ operator+=()

template<class T >
mat4< T > & mat4< T >::operator+= ( const mat4< T > &  rhs)
inline

matrix-matrix addition

Parameters
rhs
Returns

◆ operator-=()

template<class T >
mat4< T > & mat4< T >::operator-= ( const mat4< T > &  rhs)
inline

matrix-matrix subtraction

Parameters
rhs
Returns

◆ operator/=()

template<class T >
mat4< T > & mat4< T >::operator/= ( const T &  rhs)
inline

matrix-scalar division

Parameters
rhs
Returns

◆ operator==()

template<class T >
bool mat4< T >::operator== ( const mat4< T > &  rhs)
inline

equality comparison operator

Parameters
rhs
Returns

◆ operator[]() [1/2]

template<class T >
T * mat4< T >::operator[] ( int  index)
inline

member access

Parameters
index
Returns

◆ operator[]() [2/2]

template<class T >
const T * mat4< T >::operator[] ( int  index) const
inline

const member access

Parameters
index
Returns

◆ Transformation()

template<class T >
static mat4< T > mat4< T >::Transformation ( const mat3< T > &  m)
inlinestatic

transforms around given matrix

Parameters
m
Returns

◆ Transpose()

template<class T >
mat4< T > mat4< T >::Transpose ( )
inline

getter for transposed matrix

Returns
Examples
mat/TestMat4.cpp.

◆ Unit()

template<class T >
static mat4< T > mat4< T >::Unit ( )
inlinestatic

unit-matrix generator

Returns
Examples
mat/TestMat4.cpp.

Friends And Related Function Documentation

◆ operator* [1/3]

template<class T >
mat4< T > operator* ( mat4< T >  lhs,
const mat4< T > &  rhs 
)
friend

matrix-matrix multiplication

Parameters
lhs
rhs
Returns

◆ operator* [2/3]

template<class T >
mat4< T > operator* ( mat4< T >  lhs,
const T &  rhs 
)
friend

matrix-matrix multiplication

Parameters
lhs
rhs
Returns

◆ operator* [3/3]

template<class T >
vec4< T > operator* ( mat4< T >  lhs,
const vec4< T > &  rhs 
)
friend

scalar-matrix multiplication

Parameters
lhs
rhs
Returns

◆ operator+

template<class T >
mat4< T > operator+ ( mat4< T >  lhs,
const mat4< T > &  rhs 
)
friend

matrix-matrix addition

Parameters
lhs
rhs
Returns

◆ operator-

template<class T >
mat4< T > operator- ( mat4< T >  lhs,
const mat4< T > &  rhs 
)
friend

matrix-matrix subtraction

Parameters
lhs
rhs
Returns

◆ operator/

template<class T >
mat4< T > operator/ ( mat4< T >  lhs,
const T &  rhs 
)
friend

matrix-matrix division

Parameters
lhs
rhs
Returns

◆ operator<<

template<class T >
template<class U >
std::ostream & operator<< ( std::ostream &  out,
const mat4< U > &  mat 
)
friend

beautified std::cout operator

Template Parameters
U
Returns

Member Data Documentation

◆ values

template<class T >
T mat4< T >::values[4][4]

loosely packed data


The documentation for this struct was generated from the following file: