36 #include "../System/cl_platform.h" 44 template<
typename Type>
47 template<
typename Type>
50 template<
typename Type>
58 template<
typename Type>
65 for (
int i = 0;
i < 9;
i++)
72 for (
int i = 0;
i < 9;
i++)
83 explicit Mat3(
const float *init_matrix)
85 for (
int i = 0;
i < 9;
i++)
90 explicit Mat3(Type m00, Type m01, Type m02, Type m10, Type m11, Type m12, Type m20, Type m21, Type m22)
98 explicit Mat3(
const double *init_matrix)
100 for (
int i = 0;
i < 9;
i++)
105 explicit Mat3(
const int64_t *init_matrix)
107 for (
int i = 0;
i < 9;
i++)
112 explicit Mat3(
const int32_t *init_matrix)
114 for (
int i = 0;
i < 9;
i++)
119 explicit Mat3(
const int16_t *init_matrix)
121 for (
int i = 0;
i < 9;
i++)
126 explicit Mat3(
const int8_t *init_matrix)
128 for (
int i = 0;
i < 9;
i++)
156 return rotate(
angle, rotation.
x, rotation.
y, rotation.
z, normalize);
261 for (
int i = 0;
i < 9;
i++)
263 Type diff = second.matrix[
i] - first.matrix[
i];
264 if (diff < -epsilon || diff > epsilon)
return false;
297 operator Type
const*()
const {
return matrix; }
338 for (
int i = 0;
i < 9;
i++)
339 if (
matrix[
i] != other.matrix[
i])
return false;
347 template<
typename Type>
350 template<
typename Type>
353 template<
typename Type>
356 template<
typename Type>
359 template<
typename Type>
362 template<
typename Type>
365 template<
typename Type>
368 template<
typename Type>
static Mat3< Type > identity()
Definition: mat3.h:369
Mat3< double > Mat3d
Definition: mat3.h:373
Type matrix[9]
The matrix (in column-major format)
Definition: mat3.h:270
Mat3< float > Mat3f
Definition: mat3.h:372
Angle class.
Definition: angle.h:59
Mat3(Type m00, Type m01, Type m02, Type m10, Type m11, Type m12, Type m20, Type m21, Type m22)
Constructs a 3x3 matrix (copied from specified values)
Definition: mat3.h:90
Mat3< int > Mat3i
Definition: mat3.h:371
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition: mat3.h:306
static Mat3< Type > translate(const Vec2< Type > &xy)
Create a 2d translation matrix.
Definition: mat3.h:202
Mat3(const int32_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 32 bit integers)
Definition: mat3.h:112
static Mat3< Type > rotate(const Angle &angle, Vec3< Type > rotation, bool normalize=true)
Create a 3d rotation matrix.
Definition: mat3.h:154
static Mat3< Type > null()
Definition: mat3.h:366
static Mat3< Type > subtract(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Subtract 2 matrices.
Definition: mat3.h:354
Type x
Definition: vec3.h:79
static Mat3< Type > rotate(const Angle &angle, Type x, Type y, Type z, bool normalize=true)
Create a 3d rotation matrix.
static bool is_equal(const Mat3< Type > &first, const Mat3< Type > &second, Type epsilon)
Returns true if equal within the bounds of an epsilon.
Definition: mat3.h:259
Mat3(const float *init_matrix)
Constructs a 3x3 matrix (copied from 9 floats)
Definition: mat3.h:83
Type y
Definition: vec3.h:80
Mat3(const double *init_matrix)
Constructs a 3x3 matrix (copied from 9 doubles)
Definition: mat3.h:98
static Mat3< Type > translate(Type x, Type y)
Create a 2d translation matrix.
static Mat3< Type > scale(const Vec3< Type > &xy)
Create a 2d scale matrix.
Definition: mat3.h:184
Mat3< Type > & operator=(const Mat3< Type > ©)
Copy assignment operator.
Definition: mat3.h:315
double det() const
Calculate the matrix determinant.
Mat3(const int64_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 64 bit integers)
Definition: mat3.h:105
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat3.h:312
bool operator!=(const Mat3< Type > &other)
Not-equal operator.
Definition: mat3.h:344
Mat3< Type > operator+(const Mat3< Type > &add_matrix) const
Addition operator.
2D matrix
Definition: mat2.h:44
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat3.h:303
Mat3< Type > & transpose()
Calculate the transpose of this matrix.
2D vector
Definition: line.h:46
bool operator==(const Mat3< Type > &other) const
Equality operator.
Definition: mat3.h:336
3D matrix
Definition: mat2.h:47
Type y
Definition: vec2.h:81
Mat3< Type > operator-(const Mat3< Type > &sub_matrix) const
Subtraction operator.
Mat3(const int16_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 16 bit integers)
Definition: mat3.h:119
3D vector
Definition: line_ray.h:46
Mat3()
Constructs a 3x3 matrix (zero'ed)
Definition: mat3.h:63
static Mat3< Type > add(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Add 2 matrices.
Definition: mat3.h:351
Mat3(const int8_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 8 bit integers)
Definition: mat3.h:126
Mat3< Type > & adjoint()
Creates the adjoint (or known as adjugate) of the matrix.
Type x
Definition: vec2.h:80
EulerOrder
Euler angle rotation order.
Definition: angle.h:48
Type z
Definition: vec3.h:81
static Mat3< Type > scale(Type x, Type y)
Create a 2d scale matrix.
Mat3< Type > operator*(const Mat3< Type > &mult) const
Multiplication operator.
4D matrix
Definition: mat2.h:50
Mat3(const Mat3< Type > ©)
Constructs a 3x3 matrix (copied)
Definition: mat3.h:70
static Mat3< Type > multiply(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Multiply 2 matrices.
Definition: mat3.h:348
Mat3< Type > & inverse()
Create the matrix inverse. (Returns a zero matrix if the determinent = 0)
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat3.h:309
bool is_equal(const Mat3< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat3.h:294