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

#include <mat2.h>

Public Member Functions

 mat2 ()
 
 mat2 (const T &_a, const T &_b, const T &_c, const T &_d)
 
 mat2 (const vec2< T > &A, const vec2< T > &B)
 
 ~mat2 ()=default
 
mat2< T > Transpose ()
 
bool IsSymmetric ()
 
float Determinant ()
 
mat2< T > Inverse () const
 
mat2< T > & operator+= (const mat2< T > &rhs)
 
mat2< T > & operator-= (const mat2< T > &rhs)
 
mat2< T > & operator*= (const mat2< T > &rhs)
 
mat2< T > & operator*= (const T &rhs)
 
mat2< T > & operator/= (const T &rhs)
 
T * operator[] (const int &index)
 
const T * operator[] (const int &index) const
 

Static Public Member Functions

static mat2< T > Unit ()
 

Public Attributes

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

Friends

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

Detailed Description

template<class T>
struct mat2< T >

2D-Matrix representation

Template Parameters
T
Examples
TestMatrix.cpp, TestUtils.cpp, and mat/TestMat2.cpp.

Constructor & Destructor Documentation

◆ mat2() [1/3]

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

default constructor, initializes null matrix

◆ mat2() [2/3]

template<class T >
mat2< T >::mat2 ( const T &  _a,
const T &  _b,
const T &  _c,
const T &  _d 
)
inline

mat2(a, b, c, d) -> [a, b, c, d]

Parameters
_am_11
_bm_12
_cm_21
_dm_22

◆ mat2() [3/3]

template<class T >
mat2< T >::mat2 ( const vec2< T > &  A,
const vec2< T > &  B 
)
inline

mat2(A, B) -> [A.x, B.x, A.y, B.y]

Parameters
Afirst column vector
Bsecond column vector

◆ ~mat2()

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

default destructor

Member Function Documentation

◆ Determinant()

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

getter for matrix determinant

Returns

◆ Inverse()

template<class T >
mat2< T > mat2< T >::Inverse ( ) const
inline
Examples
mat/TestMat2.cpp.

◆ IsSymmetric()

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

test if matrix is symmetric

Returns
Examples
mat/TestMat2.cpp.

◆ operator*=() [1/2]

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

matrix-matrix multiplication

Parameters
rhs
Returns

◆ operator*=() [2/2]

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

matrix-scalar multiplication

Parameters
rhs
Returns

◆ operator+=()

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

matrix-matrix addition

Parameters
rhs
Returns

◆ operator-=()

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

matrix-matrix subtraction

Parameters
rhs
Returns

◆ operator/=()

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

matrix-scalar division

Parameters
rhs
Returns

◆ operator[]() [1/2]

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

element access

Parameters
index
Returns

◆ operator[]() [2/2]

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

element access

Parameters
index
Returns

◆ Transpose()

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

computes transposed

Returns
Examples
mat/TestMat2.cpp.

◆ Unit()

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

generator for unit matrix

Returns
Examples
mat/TestMat2.cpp.

Friends And Related Function Documentation

◆ operator* [1/3]

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

matrix-matrix multiplication

Parameters
lhs
rhs
Returns

◆ operator* [2/3]

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

matrix-scalar multiplication

Parameters
lhs
rhs
Returns

◆ operator* [3/3]

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

matrix-matrix multiplication

Parameters
lhs
rhs
Returns

◆ operator+

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

matrix-matrix addition

Parameters
lhs
rhs
Returns

◆ operator-

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

matrix-matrix subtraction

Parameters
lhs
rhs
Returns

◆ operator/

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

matrix-scalar division

Parameters
lhs
rhs
Returns

◆ operator<<

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

beautified std::cout operator

Template Parameters
U
Returns

Member Data Documentation

◆ values

template<class T >
T mat2< T >::values[2][2]

loosely packed data


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