34 #include "../api_core.h"
35 #include "../System/cl_platform.h"
45 template<
typename Type>
48 template<
typename Type>
51 template<
typename Type>
59 template<
typename Type>
72 for (
int i=0; i<4; i++)
83 explicit Mat2(
const float *init_matrix)
85 for (
int i=0; i<4; i++)
86 matrix[i] = (Type) init_matrix[i];
90 explicit Mat2(Type m00, Type m01, Type m10, Type m11)
97 explicit Mat2(
const double *init_matrix)
99 for (
int i=0; i<4; i++)
100 matrix[i] = (Type) init_matrix[i];
106 for (
int i=0; i<4; i++)
107 matrix[i] = (Type) init_matrix[i];
113 for (
int i=0; i<4; i++)
114 matrix[i] = (Type) init_matrix[i];
120 for (
int i=0; i<4; i++)
121 matrix[i] = (Type) init_matrix[i];
127 for (
int i=0; i<4; i++)
128 matrix[i] = (Type) init_matrix[i];
170 for (
int i=0; i<4; i++)
173 if (diff < -epsilon || diff > epsilon)
return false;
202 operator Type
const*()
const {
return matrix; }
240 for (
int i=0; i<4; i++)
Mat2< float > Mat2f
Definition: mat2.h:257
static Mat2< Type > identity()
Mat2< double > Mat2d
Definition: mat2.h:258
Angle class.
Definition: angle.h:63
static Mat2< Type > subtract(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Subtract 2 matrices.
Mat2< Type > operator+(const Mat2< Type > &add_matrix) const
Addition operator.
static Mat2< Type > null()
Mat2< Type > & operator=(const Mat2< Type > ©)
Copy assignment operator.
Definition: mat2.h:220
char byte8
Definition: cl_platform.h:59
bool is_equal(const Mat2< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat2.h:194
Mat2()
Constructs a 2x2 matrix (uninitialised)
Definition: mat2.h:67
Mat2< Type > operator*(const Mat2< Type > &mult) const
Multiplication operator.
Mat2(const byte64 *init_matrix)
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
Definition: mat2.h:104
Mat2(const byte16 *init_matrix)
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
Definition: mat2.h:118
Mat2(const double *init_matrix)
Constructs a 2x2 matrix (copied from 4 doubles)
Definition: mat2.h:97
Type matrix[4]
Definition: mat2.h:183
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:211
Mat2(const Mat2< Type > ©)
Constructs a 2x2 matrix (copied)
Definition: mat2.h:70
Mat2(Type m00, Type m01, Type m10, Type m11)
Constructs a 2x2 matrix (copied from specified values)
Definition: mat2.h:90
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:168
2D matrix
Definition: mat2.h:46
Mat2(const byte32 *init_matrix)
Constructs a 2x2 matrix (copied from 4, 32 bit integers)
Definition: mat2.h:111
Mat2< Type > operator-(const Mat2< Type > &subtract_matrix) const
Subtract operator.
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:208
3D matrix
Definition: mat2.h:49
Mat2(const byte8 *init_matrix)
Constructs a 2x2 matrix (copied from 4, 8 bit integers)
Definition: mat2.h:125
int byte32
Definition: cl_platform.h:63
long long byte64
Definition: cl_platform.h:65
Mat2< int > Mat2i
Definition: mat2.h:256
Mat2(const float *init_matrix)
Constructs a 2x2 matrix (copied from 4 floats)
Definition: mat2.h:83
static Mat2< Type > add(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Add 2 matrices.
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat2.h:214
4D matrix
Definition: mat2.h:52
bool operator==(const Mat2< Type > &other) const
Equality operator.
Definition: mat2.h:238
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat2.h:217
short byte16
Definition: cl_platform.h:61
bool operator!=(const Mat2< Type > &other) const
Not-equal operator.
Definition: mat2.h:246
static Mat2< Type > multiply(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Multiply 2 matrices.