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++)
70 for (
int i = 0;
i < 4;
i++)
81 explicit Mat2(
const float *init_matrix)
83 for (
int i = 0;
i < 4;
i++)
88 explicit Mat2(Type m00, Type m01, Type m10, Type m11)
95 explicit Mat2(
const double *init_matrix)
97 for (
int i = 0;
i < 4;
i++)
102 explicit Mat2(
const int64_t *init_matrix)
104 for (
int i = 0;
i < 4;
i++)
109 explicit Mat2(
const int32_t *init_matrix)
111 for (
int i = 0;
i < 4;
i++)
116 explicit Mat2(
const int16_t *init_matrix)
118 for (
int i = 0;
i < 4;
i++)
123 explicit Mat2(
const int8_t *init_matrix)
125 for (
int i = 0;
i < 4;
i++)
168 for (
int i = 0;
i < 4;
i++)
171 if (diff < -epsilon || diff > epsilon)
return false;
186 operator Type
const*()
const {
return matrix; }
224 for (
int i = 0;
i < 4;
i++)
Mat2< float > Mat2f
Definition: mat2.h:234
Mat2< double > Mat2d
Definition: mat2.h:235
Angle class.
Definition: angle.h:59
bool operator==(const Mat2< Type > &other) const
Equality operator.
Definition: mat2.h:222
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:198
Mat2(const int64_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
Definition: mat2.h:102
Mat2(const Mat2< Type > ©)
Constructs a 2x2 matrix (copied)
Definition: mat2.h:68
bool is_equal(const Mat2< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat2.h:183
Mat2< Type > & operator=(const Mat2< Type > ©)
Copy assignment operator.
Definition: mat2.h:204
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:201
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:177
bool operator!=(const Mat2< Type > &other) const
Not-equal operator.
Definition: mat2.h:230
2D matrix
Definition: mat2.h:44
Mat2(const float *init_matrix)
Constructs a 2x2 matrix (copied from 4 floats)
Definition: mat2.h:81
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:192
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:166
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:95
Mat2< Type > operator-(const Mat2< Type > &subtract_matrix) const
Subtract operator.
Mat2< int > Mat2i
Definition: mat2.h:233
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:123
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:195
static Mat2< Type > null()
Mat2(const int16_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
Definition: mat2.h:116
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:109
Mat2(Type m00, Type m01, Type m10, Type m11)
Constructs a 2x2 matrix (copied from specified values)
Definition: mat2.h:88