34 #include "../System/cl_platform.h"
44 template<
typename Type>
47 template<
typename Type>
50 template<
typename Type>
58 template<
typename Type>
74 for (
int i=0;
i<4;
i++)
85 explicit Mat2(
const float *init_matrix)
87 for (
int i=0;
i<4;
i++)
92 explicit Mat2(Type m00, Type m01, Type m10, Type m11)
99 explicit Mat2(
const double *init_matrix)
101 for (
int i=0;
i<4;
i++)
106 explicit Mat2(
const int64_t *init_matrix)
108 for (
int i=0;
i<4;
i++)
113 explicit Mat2(
const int32_t *init_matrix)
115 for (
int i=0;
i<4;
i++)
120 explicit Mat2(
const int16_t *init_matrix)
122 for (
int i=0;
i<4;
i++)
127 explicit Mat2(
const int8_t *init_matrix)
129 for (
int i=0;
i<4;
i++)
172 for (
int i=0;
i<4;
i++)
175 if (diff < -epsilon || diff > epsilon)
return false;
204 operator Type
const*()
const {
return matrix; }
242 for (
int i=0;
i<4;
i++)
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:219
Mat2< float > Mat2f
Definition: mat2.h:259
static Mat2< Type > identity()
Mat2(const Mat2< Type > ©)
Constructs a 2x2 matrix (copied)
Definition: mat2.h:72
Mat2(const int64_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
Definition: mat2.h:106
Mat2(Type m00, Type m01, Type m10, Type m11)
Constructs a 2x2 matrix (copied from specified values)
Definition: mat2.h:92
Mat2(const int32_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 32 bit integers)
Definition: mat2.h:113
Mat2< Type > & operator=(const Mat2< Type > ©)
Copy assignment operator.
Definition: mat2.h:222
Mat2()
Constructs a 2x2 matrix (zero'ed)
Definition: mat2.h:66
bool operator==(const Mat2< Type > &other) const
Equality operator.
Definition: mat2.h:240
bool is_equal(const Mat2< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat2.h:196
Mat2(const Mat4< Type > ©)
Constructs a 2x2 matrix (copied from a 4d matrix)
static Mat2< Type > add(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Add 2 matrices.
Mat2< Type > operator+(const Mat2< Type > &add_matrix) const
Addition operator.
2D matrix
Definition: mat2.h:45
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:170
Angle class.
Definition: angle.h:63
Type matrix[4]
Definition: mat2.h:185
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:213
static Mat2< Type > subtract(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Subtract 2 matrices.
Mat2(const Mat3< Type > ©)
Constructs a 2x2 matrix (copied from a 3d matrix)
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:216
Mat2(const int8_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 8 bit integers)
Definition: mat2.h:127
4D matrix
Definition: mat2.h:51
Mat2(const float *init_matrix)
Constructs a 2x2 matrix (copied from 4 floats)
Definition: mat2.h:85
bool operator!=(const Mat2< Type > &other) const
Not-equal operator.
Definition: mat2.h:248
Mat2< int > Mat2i
Definition: mat2.h:258
Mat2< double > Mat2d
Definition: mat2.h:260
Mat2(const double *init_matrix)
Constructs a 2x2 matrix (copied from 4 doubles)
Definition: mat2.h:99
Mat2(const int16_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
Definition: mat2.h:120
3D matrix
Definition: mat2.h:48
static Mat2< Type > multiply(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Multiply 2 matrices.
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:210
Mat2< Type > operator-(const Mat2< Type > &subtract_matrix) const
Subtract operator.
Mat2< Type > operator*(const Mat2< Type > &mult) const
Multiplication operator.