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 > ©)=default | |
Constructs a 2x2 matrix (copied) | |
Mat2 (const Mat3< Type > ©) | |
Constructs a 2x2 matrix (copied from a 3d matrix) | |
Mat2 (const Mat4< Type > ©) | |
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 > ©)=default |
Copy assignment operator. | |
Mat2< Type > & | operator= (const Mat3< Type > ©) |
Copy assignment operator. | |
Mat2< Type > & | operator= (const Mat4< Type > ©) |
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) | |
2D matrix
These matrix templates are defined for: int (Mat2i), float (Mat2f), double (Mat2d)
|
inline |
Constructs a 2x2 matrix (zero'ed)
|
default |
Constructs a 2x2 matrix (copied)
|
explicit |
Constructs a 2x2 matrix (copied from a 3d matrix)
|
explicit |
Constructs a 2x2 matrix (copied from a 4d matrix)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from 4 floats)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from specified values)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from 4 doubles)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from 4, 32 bit integers)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
|
inlineexplicit |
Constructs a 2x2 matrix (copied from 4, 8 bit integers)
|
static |
Add 2 matrices.
This adds the matrix as follows: result = matrix1 + matrix2
matrix_1 | = First Matrix to add |
matrix_2 | = Second Matrix to add |
|
static |
|
inlinestatic |
Returns true if equal within the bounds of an epsilon.
first | = Value A |
second | = Value B |
epsilon | = The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2) |
Referenced by clan::Mat2< int >::is_equal().
|
inline |
Returns true if equal within the bounds of an epsilon.
other | = Other value |
epsilon | = The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/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)
matrix_1 | = First Matrix to multiply |
matrix_2 | = Second Matrix to multiply |
|
static |
|
inline |
Operator that returns the matrix as a array.
|
inline |
Operator that returns the matrix as a array.
|
inline |
Not-equal operator.
Mat2< Type > clan::Mat2< Type >::operator* | ( | const Mat2< Type > & | mult | ) | const |
Multiplication operator.
Mat2< Type > clan::Mat2< Type >::operator+ | ( | const Mat2< Type > & | add_matrix | ) | const |
Addition operator.
Mat2< Type > clan::Mat2< Type >::operator- | ( | const Mat2< Type > & | subtract_matrix | ) | const |
Subtract operator.
|
default |
Copy assignment operator.
Mat2< Type > & clan::Mat2< Type >::operator= | ( | const Mat3< Type > & | copy | ) |
Copy assignment operator.
Mat2< Type > & clan::Mat2< Type >::operator= | ( | const Mat4< Type > & | copy | ) |
Copy assignment operator.
|
inline |
Equality operator.
|
inline |
Operator that returns the matrix cell at the given index.
|
inline |
Operator that returns the matrix cell at the given index.
|
inline |
Operator that returns the matrix cell at the given index.
|
inline |
Operator that returns the matrix cell at the given index.
|
static |
Subtract 2 matrices.
This subtract the matrix as follows: result = matrix1 - matrix2
matrix_1 | = First Matrix to subtract |
matrix_2 | = Second Matrix to subtract |
Type clan::Mat2< Type >::matrix[4] |
The matrix (in column-major format)
Referenced by clan::Mat2< int >::is_equal(), clan::Mat2< int >::operator==(), clan::ProgramObject::set_uniform_matrix(), and clan::ProgramObject::set_uniform_matrix().