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++)
79 explicit Mat3(
const float *init_matrix)
81 for (
int i = 0;
i < 9;
i++)
86 explicit Mat3(Type m00, Type m01, Type m02, Type m10, Type m11, Type m12, Type m20, Type m21, Type m22)
94 explicit Mat3(
const double *init_matrix)
96 for (
int i = 0;
i < 9;
i++)
101 explicit Mat3(
const int64_t *init_matrix)
103 for (
int i = 0;
i < 9;
i++)
108 explicit Mat3(
const int32_t *init_matrix)
110 for (
int i = 0;
i < 9;
i++)
115 explicit Mat3(
const int16_t *init_matrix)
117 for (
int i = 0;
i < 9;
i++)
122 explicit Mat3(
const int8_t *init_matrix)
124 for (
int i = 0;
i < 9;
i++)
152 return rotate(
angle, rotation.
x, rotation.
y, rotation.
z, normalize);
257 for (
int i = 0;
i < 9;
i++)
260 if (diff < -epsilon || diff > epsilon)
return false;
293 operator Type
const*()
const {
return matrix; }
334 for (
int i = 0;
i < 9;
i++)
343 template<
typename Type>
346 template<
typename Type>
349 template<
typename Type>
352 template<
typename Type>
355 template<
typename Type>
358 template<
typename Type>
361 template<
typename Type>
364 template<
typename Type>
Angle class.
Definition angle.h:60
2D matrix
Definition mat2.h:59
3D matrix
Definition mat3.h:60
static Mat3< Type > rotate(const Angle &angle, Vec3< Type > rotation, bool normalize=true)
Create a 3d rotation matrix.
Definition mat3.h:150
bool operator==(const Mat3< Type > &other) const
Equality operator.
Definition mat3.h:332
double det() const
Calculate the matrix determinant.
static Mat3< Type > rotate(const Angle &angle)
Create a 2d rotation matrix.
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:86
Mat3< Type > & transpose()
Calculate the transpose of this matrix.
bool operator!=(const Mat3< Type > &other)
Not-equal operator.
Definition mat3.h:340
static Mat3< Type > scale(Type x, Type y)
Create a 2d scale matrix.
Mat3< Type > & operator=(const Mat3< Type > ©)=default
Copy assignment operator.
int matrix[9]
Definition mat3.h:266
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition mat3.h:308
static Mat3< Type > translate(const Vec2< Type > &xy)
Create a 2d translation matrix.
Definition mat3.h:198
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition mat3.h:305
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:255
Mat3< Type > operator-(const Mat3< Type > &sub_matrix) const
Subtraction operator.
Mat3(const Mat4< Type > ©)
Constructs a 3x3 matrix (copied from a 4d matrix)
Mat3< Type > operator*(const Mat3< Type > &mult) const
Multiplication operator.
Mat3< Type > operator+(const Mat3< Type > &add_matrix) const
Addition operator.
Mat3(const float *init_matrix)
Constructs a 3x3 matrix (copied from 9 floats)
Definition mat3.h:79
Mat3()
Constructs a 3x3 matrix (zero'ed)
Definition mat3.h:63
Mat3(const int8_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 8 bit integers)
Definition mat3.h:122
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition mat3.h:302
static Mat3< Type > translate(Type x, Type y)
Create a 2d translation matrix.
static Mat3< Type > rotate(const Angle &angle_x, const Angle &angle_y, const Angle &angle_z, EulerOrder order)
Create a 3d rotation matrix using euler angles.
Mat3(const int32_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 32 bit integers)
Definition mat3.h:108
bool is_equal(const Mat3< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition mat3.h:290
Mat3< Type > & inverse()
Create the matrix inverse. (Returns a zero matrix if the determinent = 0)
Mat3< Type > & adjoint()
Creates the adjoint (or known as adjugate) of the matrix.
Mat3(const int64_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 64 bit integers)
Definition mat3.h:101
Mat3(const int16_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 16 bit integers)
Definition mat3.h:115
static Mat3< Type > scale(const Vec3< Type > &xy)
Create a 2d scale matrix.
Definition mat3.h:180
Mat3(const double *init_matrix)
Constructs a 3x3 matrix (copied from 9 doubles)
Definition mat3.h:94
static Mat3< Type > rotate(const Angle &angle, Type x, Type y, Type z, bool normalize=true)
Create a 3d rotation matrix.
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition mat3.h:299
Mat3(const Mat3< Type > ©)=default
Constructs a 3x3 matrix (copied)
Mat3(const Mat2< Type > ©)
Constructs a 3x3 matrix (copied from a 2d matrix)
4D matrix
Definition mat4.h:78
2D vector
Definition vec2.h:76
Type y
Definition vec2.h:81
Type x
Definition vec2.h:80
3D vector
Definition vec3.h:75
Type z
Definition vec3.h:81
Type y
Definition vec3.h:80
Type x
Definition vec3.h:79
@ null
Definition json_value.h:49
Mat3< double > Mat3d
Definition mat3.h:369
static Mat3< Type > transpose(const Mat3< Type > &matrix)
Calculate the transpose of a matrix.
Definition mat3.h:359
static Mat3< Type > multiply(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Multiply 2 matrices.
Definition mat3.h:344
Mat3< float > Mat3f
Definition mat3.h:368
static Mat3< Type > adjoint(const Mat3< Type > &matrix)
Calculate the adjoint (or known as Adjugate or Conjugate Transpose) of a matrix.
Definition mat3.h:353
static Mat3< Type > subtract(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Subtract 2 matrices.
Definition mat3.h:350
Mat3< int > Mat3i
Definition mat3.h:367
static Mat3< Type > add(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Add 2 matrices.
Definition mat3.h:347
static Mat3< Type > null()
Definition mat3.h:362
EulerOrder
Euler angle rotation order.
Definition angle.h:49
static Mat3< Type > identity()
Definition mat3.h:365
static Mat3< Type > inverse(const Mat3< Type > &matrix)
Calculate the matrix inverse of a matrix.
Definition mat3.h:356
@ angle
value is a color
Definition style_value_type.h:44