33 #include "../System/cl_platform.h" 43 template<
typename Type>
46 template<
typename Type>
49 template<
typename Type>
57 template<
typename Type>
64 for (
int i = 0;
i < 4;
i++)
77 explicit Mat2(
const float *init_matrix)
79 for (
int i = 0;
i < 4;
i++)
84 explicit Mat2(Type m00, Type m01, Type m10, Type m11)
91 explicit Mat2(
const double *init_matrix)
93 for (
int i = 0;
i < 4;
i++)
98 explicit Mat2(
const int64_t *init_matrix)
100 for (
int i = 0;
i < 4;
i++)
105 explicit Mat2(
const int32_t *init_matrix)
107 for (
int i = 0;
i < 4;
i++)
112 explicit Mat2(
const int16_t *init_matrix)
114 for (
int i = 0;
i < 4;
i++)
119 explicit Mat2(
const int8_t *init_matrix)
121 for (
int i = 0;
i < 4;
i++)
164 for (
int i = 0;
i < 4;
i++)
167 if (diff < -epsilon || diff > epsilon)
return false;
182 operator Type
const*()
const {
return matrix; }
220 for (
int i = 0;
i < 4;
i++)
Mat2< float > Mat2f
Definition: mat2.h:230
Mat2< double > Mat2d
Definition: mat2.h:231
Angle class.
Definition: angle.h:59
bool operator==(const Mat2< Type > &other) const
Equality operator.
Definition: mat2.h:218
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:194
Mat2(const int64_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
Definition: mat2.h:98
bool is_equal(const Mat2< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat2.h:179
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:197
static Mat2< Type > multiply(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Multiply 2 matrices.
Type matrix[4]
The matrix (in column-major format)
Definition: mat2.h:173
bool operator!=(const Mat2< Type > &other) const
Not-equal operator.
Definition: mat2.h:226
Mat2< Type > & operator=(const Mat2< Type > ©)=default
Copy assignment operator.
2D matrix
Definition: mat2.h:44
Mat2(const float *init_matrix)
Constructs a 2x2 matrix (copied from 4 floats)
Definition: mat2.h:77
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:188
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.
Definition: mat2.h:162
Mat2()
Constructs a 2x2 matrix (zero'ed)
Definition: mat2.h:62
3D matrix
Definition: mat2.h:47
Mat2(const double *init_matrix)
Constructs a 2x2 matrix (copied from 4 doubles)
Definition: mat2.h:91
Mat2< Type > operator-(const Mat2< Type > &subtract_matrix) const
Subtract operator.
Mat2< int > Mat2i
Definition: mat2.h:229
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.
Mat2(const int8_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 8 bit integers)
Definition: mat2.h:119
Mat2< Type > operator+(const Mat2< Type > &add_matrix) const
Addition operator.
4D matrix
Definition: mat2.h:50
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:191
static Mat2< Type > null()
Mat2(const int16_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
Definition: mat2.h:112
static Mat2< Type > subtract(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Subtract 2 matrices.
Mat2(const int32_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 32 bit integers)
Definition: mat2.h:105
Mat2(Type m00, Type m01, Type m10, Type m11)
Constructs a 2x2 matrix (copied from specified values)
Definition: mat2.h:84