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++)
2D matrix
Definition mat2.h:59
Mat2(const int64_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 64 bit integers)
Definition mat2.h:102
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition mat2.h:198
Mat2(const int8_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 8 bit integers)
Definition mat2.h:123
static Mat2< Type > null()
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition mat2.h:195
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition mat2.h:192
Mat2(const int32_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 32 bit integers)
Definition mat2.h:109
Mat2(const Mat3< Type > ©)
Constructs a 2x2 matrix (copied from a 3d matrix)
Mat2< Type > & operator=(const Mat2< Type > ©)
Copy assignment operator.
Definition mat2.h:204
Mat2(const double *init_matrix)
Constructs a 2x2 matrix (copied from 4 doubles)
Definition mat2.h:95
static Mat2< Type > identity()
Mat2(const float *init_matrix)
Constructs a 2x2 matrix (copied from 4 floats)
Definition mat2.h:81
static Mat2< Type > add(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Add 2 matrices.
Mat2(const Mat4< Type > ©)
Constructs a 2x2 matrix (copied from a 4d matrix)
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
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(const Mat2< Type > ©)
Constructs a 2x2 matrix (copied)
Definition mat2.h:68
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
Mat2< Type > operator*(const Mat2< Type > &mult) const
Multiplication operator.
Mat2(const int16_t *init_matrix)
Constructs a 2x2 matrix (copied from 4, 16 bit integers)
Definition mat2.h:116
Mat2< Type > operator+(const Mat2< Type > &add_matrix) const
Addition operator.
bool operator!=(const Mat2< Type > &other) const
Not-equal operator.
Definition mat2.h:230
Mat2(Type m00, Type m01, Type m10, Type m11)
Constructs a 2x2 matrix (copied from specified values)
Definition mat2.h:88
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition mat2.h:201
static Mat2< Type > subtract(const Mat2< Type > &matrix_1, const Mat2< Type > &matrix_2)
Subtract 2 matrices.
bool operator==(const Mat2< Type > &other) const
Equality operator.
Definition mat2.h:222
Mat2< Type > operator-(const Mat2< Type > &subtract_matrix) const
Subtract operator.
3D matrix
Definition mat3.h:60
4D matrix
Definition mat4.h:78
Mat2< int > Mat2i
Definition mat2.h:233
Mat2< float > Mat2f
Definition mat2.h:234
Mat2< double > Mat2d
Definition mat2.h:235