40 template<
typename Type>
43 template<
typename Type>
46 template<
typename Type>
52 template<
typename Type>
65 for (
int i = 0;
i < 4;
i++)
76 explicit Mat2(
const float *init_matrix)
78 for (
int i = 0;
i < 4;
i++)
83 explicit Mat2(Type m00, Type m01, Type m10, Type m11)
90 explicit Mat2(
const double *init_matrix)
92 for (
int i = 0;
i < 4;
i++)
97 explicit Mat2(
const int64_t *init_matrix)
99 for (
int i = 0;
i < 4;
i++)
104 explicit Mat2(
const int32_t *init_matrix)
106 for (
int i = 0;
i < 4;
i++)
111 explicit Mat2(
const int16_t *init_matrix)
113 for (
int i = 0;
i < 4;
i++)
118 explicit Mat2(
const int8_t *init_matrix)
120 for (
int i = 0;
i < 4;
i++)
163 for (
int i = 0;
i < 4;
i++)
166 if (diff < -epsilon || diff > epsilon)
return false;
181 operator Type
const*()
const {
return matrix; }
219 for (
int i = 0;
i < 4;
i++)
220 if (matrix[
i] != other.
matrix[
i])
return false;
Mat2()
Constructs a 2x2 matrix (zero'ed)
Definition: mat2.h:57
2D matrix
Definition: mat2.h:41
bool operator==(const Mat2< Type > &other) const
Equality operator.
Definition: mat2.h:217
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:187
bool operator!=(const Mat2< Type > &other) const
Not-equal operator.
Definition: mat2.h:225
Mat2< Type > & operator=(const Mat2< Type > ©)
Copy assignment operator.
Definition: mat2.h:199
Mat2(Type m00, Type m01, Type m10, Type m11)
Constructs a 2x2 matrix (copied from specified values)
Definition: mat2.h:83
3D matrix
Definition: mat2.h:44
Type matrix[4]
The matrix (in column-major format)
Definition: mat2.h:172
Mat2< Type > operator-(const Mat2< Type > &subtract_matrix) const
Subtract operator.
Mat2(const Mat2< Type > ©)
Constructs a 2x2 matrix (copied)
Definition: mat2.h:63
Mat2(const int16_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
Definition: mat2.h:111
Mat2(const int32_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 32 bit integers)
Definition: mat2.h:104
static Mat2< Type > null()
bool is_equal(const Mat2< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat2.h:178
Mat2< int > Mat2i
Definition: mat2.h:228
Mat2(const double *init_matrix)
Constructs a 2x2 matrix (copied from 4 doubles)
Definition: mat2.h:90
Mat2(const float *init_matrix)
Constructs a 2x2 matrix (copied from 4 floats)
Definition: mat2.h:76
Mat2< Type > operator+(const Mat2< Type > &add_matrix) const
Addition operator.
static Mat2< Type > multiply(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Multiply 2 matrices.
static Mat2< Type > identity()
Mat2(const int64_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
Definition: mat2.h:97
static bool is_equal(const Mat2< Type > &first, const Mat2< Type > &second, Type epsilon)
Returns true if equal within the bounds of an epsilon.
Definition: mat2.h:161
Mat2< Type > operator*(const Mat2< Type > &mult) const
Multiplication operator.
static Mat2< Type > add(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Add 2 matrices.
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:190
Mat2(const int8_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 8 bit integers)
Definition: mat2.h:118
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:193
static Mat2< Type > subtract(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Subtract 2 matrices.
Mat2< float > Mat2f
Definition: mat2.h:229
Mat2< double > Mat2d
Definition: mat2.h:230
Definition: Application/application.h:35
4D matrix
Definition: mat2.h:47
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:196