2D matrix More...

#include <mat2.h>

Public Member Functions

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

Static Public Member Functions

static Mat2< Type > add (const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
 Add 2 matrices.
 
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.
 
static Mat2< Type > multiply (const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
 Multiply 2 matrices.
 
static Mat2< Type > null ()
 
static Mat2< Type > subtract (const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
 Subtract 2 matrices.
 

Public Attributes

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

Detailed Description

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

2D matrix

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

Constructor & Destructor Documentation

◆ Mat2() [1/11]

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

Constructs a 2x2 matrix (zero'ed)

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

◆ Mat2() [2/11]

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

Constructs a 2x2 matrix (copied)

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

◆ Mat2() [3/11]

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

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

◆ Mat2() [4/11]

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

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

◆ Mat2() [5/11]

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

Constructs a 2x2 matrix (copied from 4 floats)

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

◆ Mat2() [6/11]

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

Constructs a 2x2 matrix (copied from specified values)

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

◆ Mat2() [7/11]

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

Constructs a 2x2 matrix (copied from 4 doubles)

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

◆ Mat2() [8/11]

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

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

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

◆ Mat2() [9/11]

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

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

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

◆ Mat2() [10/11]

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

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

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

◆ Mat2() [11/11]

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

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

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

Member Function Documentation

◆ add()

template<typename Type >
static Mat2< Type > clan::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

◆ identity()

template<typename Type >
static Mat2< Type > clan::Mat2< Type >::identity ( )
static

◆ is_equal() [1/2]

template<typename Type >
static bool clan::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 clan::i, and clan::Mat2< Type >::matrix.

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

◆ is_equal() [2/2]

template<typename Type >
bool clan::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 clan::Mat2< Type >::is_equal().

◆ multiply()

template<typename Type >
static Mat2< Type > clan::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

◆ null()

template<typename Type >
static Mat2< Type > clan::Mat2< Type >::null ( )
static

◆ operator Type *()

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

Operator that returns the matrix as a array.

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

◆ operator Type const *()

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

Operator that returns the matrix as a array.

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

◆ operator!=()

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

Not-equal operator.

◆ operator*()

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

Multiplication operator.

◆ operator+()

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

Addition operator.

◆ operator-()

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

Subtract operator.

◆ operator=() [1/3]

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

Copy assignment operator.

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

◆ operator=() [2/3]

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

Copy assignment operator.

◆ operator=() [3/3]

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

Copy assignment operator.

◆ operator==()

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

Equality operator.

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

◆ operator[]() [1/4]

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

Operator that returns the matrix cell at the given index.

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

◆ operator[]() [2/4]

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

Operator that returns the matrix cell at the given index.

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

◆ operator[]() [3/4]

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

Operator that returns the matrix cell at the given index.

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

◆ operator[]() [4/4]

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

Operator that returns the matrix cell at the given index.

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

◆ subtract()

template<typename Type >
static Mat2< Type > clan::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

◆ matrix


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