2D matrix More...

#include <mat2.h>

Public Member Functions

 Mat2 ()
 Constructs a 2x2 matrix (zero'ed) More...
 
 Mat2 (const Mat2< Type > &copy)
 Constructs a 2x2 matrix (copied) More...
 
 Mat2 (const Mat3< Type > &copy)
 Constructs a 2x2 matrix (copied from a 3d matrix) More...
 
 Mat2 (const Mat4< Type > &copy)
 Constructs a 2x2 matrix (copied from a 4d matrix) More...
 
 Mat2 (const float *init_matrix)
 Constructs a 2x2 matrix (copied from 4 floats) More...
 
 Mat2 (Type m00, Type m01, Type m10, Type m11)
 Constructs a 2x2 matrix (copied from specified values) More...
 
 Mat2 (const double *init_matrix)
 Constructs a 2x2 matrix (copied from 4 doubles) More...
 
 Mat2 (const int64_t *init_matrix)
 Constructs a 2x2 matrix (copied from 4, 64 bit integers) More...
 
 Mat2 (const int32_t *init_matrix)
 Constructs a 2x2 matrix (copied from 4, 32 bit integers) More...
 
 Mat2 (const int16_t *init_matrix)
 Constructs a 2x2 matrix (copied from 4, 16 bit integers) More...
 
 Mat2 (const int8_t *init_matrix)
 Constructs a 2x2 matrix (copied from 4, 8 bit integers) More...
 
bool is_equal (const Mat2< Type > &other, Type epsilon) const
 Returns true if equal within the bounds of an epsilon. More...
 
 operator Type * ()
 Operator that returns the matrix as a array. More...
 
 operator Type const * () const
 Operator that returns the matrix as a array. More...
 
bool operator!= (const Mat2< Type > &other) const
 Not-equal operator. More...
 
Mat2< Type > operator* (const Mat2< Type > &mult) const
 Multiplication operator. More...
 
Mat2< Type > operator+ (const Mat2< Type > &add_matrix) const
 Addition operator. More...
 
Mat2< Type > operator- (const Mat2< Type > &subtract_matrix) const
 Subtract operator. More...
 
Mat2< Type > & operator= (const Mat2< Type > &copy)
 Copy assignment operator. More...
 
Mat2< Type > & operator= (const Mat4< Type > &copy)
 Copy assignment operator. More...
 
Mat2< Type > & operator= (const Mat3< Type > &copy)
 Copy assignment operator. More...
 
bool operator== (const Mat2< Type > &other) const
 Equality operator. More...
 
Type & operator[] (int i)
 Operator that returns the matrix cell at the given index. More...
 
const Type & operator[] (int i) const
 Operator that returns the matrix cell at the given index. More...
 
Type & operator[] (unsigned int i)
 Operator that returns the matrix cell at the given index. More...
 
const Type & operator[] (unsigned int i) const
 Operator that returns the matrix cell at the given index. More...
 

Static Public Member Functions

static Mat2< Type > add (const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
 Add 2 matrices. More...
 
static Mat2< Type > identity ()
 
static bool is_equal (const Mat2< Type > &first, const Mat2< Type > &second, Type epsilon)
 Returns true if equal within the bounds of an epsilon. More...
 
static Mat2< Type > multiply (const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
 Multiply 2 matrices. More...
 
static Mat2< Type > null ()
 
static Mat2< Type > subtract (const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
 Subtract 2 matrices. More...
 

Public Attributes

Type matrix [4]
 The matrix (in column-major format) More...
 

Detailed Description

template<typename Type>
class uicore::Mat2< Type >

2D matrix

These matrix templates are defined for: int (Mat2i), float (Mat2f), double (Mat2d)

Constructor & Destructor Documentation

template<typename Type>
uicore::Mat2< Type >::Mat2 ( )
inline

Constructs a 2x2 matrix (zero'ed)

References uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const Mat2< Type > &  copy)
inline

Constructs a 2x2 matrix (copied)

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const Mat3< Type > &  copy)
explicit

Constructs a 2x2 matrix (copied from a 3d matrix)

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const Mat4< Type > &  copy)
explicit

Constructs a 2x2 matrix (copied from a 4d matrix)

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const float *  init_matrix)
inlineexplicit

Constructs a 2x2 matrix (copied from 4 floats)

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( Type  m00,
Type  m01,
Type  m10,
Type  m11 
)
inlineexplicit

Constructs a 2x2 matrix (copied from specified values)

References uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const double *  init_matrix)
inlineexplicit

Constructs a 2x2 matrix (copied from 4 doubles)

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const int64_t *  init_matrix)
inlineexplicit

Constructs a 2x2 matrix (copied from 4, 64 bit integers)

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const int32_t *  init_matrix)
inlineexplicit

Constructs a 2x2 matrix (copied from 4, 32 bit integers)

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const int16_t *  init_matrix)
inlineexplicit

Constructs a 2x2 matrix (copied from 4, 16 bit integers)

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::Mat2 ( const int8_t *  init_matrix)
inlineexplicit

Constructs a 2x2 matrix (copied from 4, 8 bit integers)

References uicore::i, and uicore::Mat2< Type >::matrix.

Member Function Documentation

template<typename Type>
static Mat2<Type> uicore::Mat2< Type >::add ( const Mat2< Type > &  matrix_1,
const Mat2< Type > &  matrix_2 
)
static

Add 2 matrices.

This adds the matrix as follows: result = matrix1 + matrix2

Parameters
matrix_1= First Matrix to add
matrix_2= Second Matrix to add
Returns
The matrix
template<typename Type>
static Mat2<Type> uicore::Mat2< Type >::identity ( )
static
template<typename Type>
static bool uicore::Mat2< Type >::is_equal ( const Mat2< Type > &  first,
const Mat2< Type > &  second,
Type  epsilon 
)
inlinestatic

Returns true if equal within the bounds of an epsilon.

Parameters
first= Value A
second= Value B
epsilon= The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2)

References uicore::i, and uicore::Mat2< Type >::matrix.

Referenced by uicore::Mat2< Type >::is_equal().

template<typename Type>
bool uicore::Mat2< Type >::is_equal ( const Mat2< Type > &  other,
Type  epsilon 
) const
inline

Returns true if equal within the bounds of an epsilon.

Parameters
other= Other value
epsilon= The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2)

References uicore::Mat2< Type >::is_equal().

template<typename Type>
static Mat2<Type> uicore::Mat2< Type >::multiply ( const Mat2< Type > &  matrix_1,
const Mat2< Type > &  matrix_2 
)
static

Multiply 2 matrices.

This multiplies the matrix as follows: result = matrix1 * matrix2
Matrix is multiplied in the Column-Major matrix format (opengl native)

Parameters
matrix_1= First Matrix to multiply
matrix_2= Second Matrix to multiply
Returns
The matrix
template<typename Type>
static Mat2<Type> uicore::Mat2< Type >::null ( )
static
template<typename Type>
uicore::Mat2< Type >::operator Type * ( )
inline

Operator that returns the matrix as a array.

References uicore::Mat2< Type >::matrix.

template<typename Type>
uicore::Mat2< Type >::operator Type const * ( ) const
inline

Operator that returns the matrix as a array.

References uicore::Mat2< Type >::matrix.

template<typename Type>
bool uicore::Mat2< Type >::operator!= ( const Mat2< Type > &  other) const
inline

Not-equal operator.

template<typename Type>
Mat2<Type> uicore::Mat2< Type >::operator* ( const Mat2< Type > &  mult) const

Multiplication operator.

template<typename Type>
Mat2<Type> uicore::Mat2< Type >::operator+ ( const Mat2< Type > &  add_matrix) const

Addition operator.

template<typename Type>
Mat2<Type> uicore::Mat2< Type >::operator- ( const Mat2< Type > &  subtract_matrix) const

Subtract operator.

template<typename Type>
Mat2<Type>& uicore::Mat2< Type >::operator= ( const Mat2< Type > &  copy)
inline

Copy assignment operator.

References uicore::Mat2< Type >::matrix.

template<typename Type>
Mat2<Type>& uicore::Mat2< Type >::operator= ( const Mat4< Type > &  copy)

Copy assignment operator.

template<typename Type>
Mat2<Type>& uicore::Mat2< Type >::operator= ( const Mat3< Type > &  copy)

Copy assignment operator.

template<typename Type>
bool uicore::Mat2< Type >::operator== ( const Mat2< Type > &  other) const
inline

Equality operator.

References uicore::i, and uicore::Mat2< Type >::matrix.

template<typename Type>
Type& uicore::Mat2< Type >::operator[] ( int  i)
inline

Operator that returns the matrix cell at the given index.

References uicore::i.

template<typename Type>
const Type& uicore::Mat2< Type >::operator[] ( int  i) const
inline

Operator that returns the matrix cell at the given index.

References uicore::i.

template<typename Type>
Type& uicore::Mat2< Type >::operator[] ( unsigned int  i)
inline

Operator that returns the matrix cell at the given index.

References uicore::i.

template<typename Type>
const Type& uicore::Mat2< Type >::operator[] ( unsigned int  i) const
inline

Operator that returns the matrix cell at the given index.

References uicore::i.

template<typename Type>
static Mat2<Type> uicore::Mat2< Type >::subtract ( const Mat2< Type > &  matrix_1,
const Mat2< Type > &  matrix_2 
)
static

Subtract 2 matrices.

This subtract the matrix as follows: result = matrix1 - matrix2

Parameters
matrix_1= First Matrix to subtract
matrix_2= Second Matrix to subtract
Returns
The matrix

Member Data Documentation


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