37 #include "../System/cl_platform.h" 45 template<
typename Type>
48 template<
typename Type>
51 template<
typename Type>
59 template<
typename Type>
76 for (
int i=0;
i<9;
i++)
87 explicit Mat3(
const float *init_matrix)
89 for (
int i=0;
i<9;
i++)
94 explicit Mat3(Type m00, Type m01, Type m02, Type m10, Type m11, Type m12, Type m20, Type m21, Type m22)
102 explicit Mat3(
const double *init_matrix)
104 for (
int i=0;
i<9;
i++)
109 explicit Mat3(
const int64_t *init_matrix)
111 for (
int i=0;
i<9;
i++)
116 explicit Mat3(
const int32_t *init_matrix)
118 for (
int i=0;
i<9;
i++)
123 explicit Mat3(
const int16_t *init_matrix)
125 for (
int i=0;
i<9;
i++)
130 explicit Mat3(
const int8_t *init_matrix)
132 for (
int i=0;
i<9;
i++)
160 return rotate(
angle, rotation.
x, rotation.
y, rotation.
z, normalize);
265 for (
int i=0;
i<9;
i++)
267 Type diff = second.matrix[
i] - first.matrix[
i];
268 if (diff < -epsilon || diff > epsilon)
return false;
315 operator Type
const*()
const {
return matrix; }
356 for (
int i=0;
i<9;
i++)
357 if (
matrix[
i] != other.matrix[
i])
return false;
372 template<
typename Type>
375 template<
typename Type>
378 template<
typename Type>
381 template<
typename Type>
384 template<
typename Type>
387 template<
typename Type>
390 template<
typename Type>
393 template<
typename Type>
static Mat3< Type > identity()
Definition: mat3.h:394
Mat3< double > Mat3d
Definition: mat3.h:398
Type x
Definition: vec3.h:80
Mat3< float > Mat3f
Definition: mat3.h:397
static Mat3< Type > rotate(const Angle &angle, Vec3< Type > rotation, bool normalize=true)
Create a 3d rotation matrix.
Definition: mat3.h:158
static Mat3< Type > rotate(const Angle &angle, Type x, Type y, Type z, bool normalize=true)
Create a 3d rotation matrix.
Angle class.
Definition: angle.h:62
Mat3< int > Mat3i
Definition: mat3.h:396
Mat3< Type > & operator=(const Mat3< Type > ©)
Copy assignment operator.
Definition: mat3.h:333
Type y
Definition: vec3.h:81
Mat3< Type > operator*(const Mat3< Type > &mult) const
Multiplication operator.
Mat3(const int8_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 8 bit integers)
Definition: mat3.h:130
Mat3(const int16_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 16 bit integers)
Definition: mat3.h:123
static Mat3< Type > null()
Definition: mat3.h:391
static Mat3< Type > subtract(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Subtract 2 matrices.
Definition: mat3.h:379
bool operator!=(const Mat3< Type > &other)
Not-equal operator.
Definition: mat3.h:362
Mat3(const int64_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 64 bit integers)
Definition: mat3.h:109
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:263
Type & operator[](int i)
Operator that returns the matrix cell at the given index.
Definition: mat3.h:321
double det() const
Calculate the matrix determinant.
static Mat3< Type > scale(const Vec3< Type > &xy)
Create a 2d scale matrix.
Definition: mat3.h:188
Type x
Definition: vec2.h:80
Mat3< Type > & transpose()
Calculate the transpose of this matrix.
2D matrix
Definition: mat2.h:45
bool is_equal(const Mat3< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition: mat3.h:307
Type & operator[](unsigned int i)
Operator that returns the matrix cell at the given index.
Definition: mat3.h:327
2D vector
Definition: line.h:48
3D matrix
Definition: mat2.h:48
Mat3(const Mat3< Type > ©)
Constructs a 3x3 matrix (copied)
Definition: mat3.h:74
const Type & operator[](int i) const
Operator that returns the matrix cell at the given index.
Definition: mat3.h:324
Mat3()
Constructs a 3x3 matrix (zero'ed)
Definition: mat3.h:67
3D vector
Definition: line_ray.h:48
Mat3(const int32_t *init_matrix)
Constructs a 3x3 matrix (copied from 9, 32 bit integers)
Definition: mat3.h:116
Mat3< Type > operator-(const Mat3< Type > &sub_matrix) const
Subtraction operator.
static Mat3< Type > add(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Add 2 matrices.
Definition: mat3.h:376
EulerOrder
Euler angle rotation order.
Definition: angle.h:50
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:94
static Mat3< Type > scale(Type x, Type y)
Create a 2d scale matrix.
4D matrix
Definition: mat2.h:51
Mat3(const double *init_matrix)
Constructs a 3x3 matrix (copied from 9 doubles)
Definition: mat3.h:102
Mat3< Type > & adjoint()
Creates the adjoint (or known as adjugate) of the matrix.
static Mat3< Type > multiply(const Mat3< Type > &matrix_1, const Mat3< Type > &matrix_2)
Multiply 2 matrices.
Definition: mat3.h:373
Mat3< Type > & inverse()
Create the matrix inverse. (Returns a zero matrix if the determinent = 0)
bool operator==(const Mat3< Type > &other) const
Equality operator.
Definition: mat3.h:354
Type matrix[9]
Definition: mat3.h:278
Mat3(const float *init_matrix)
Constructs a 3x3 matrix (copied from 9 floats)
Definition: mat3.h:87
const Type & operator[](unsigned int i) const
Operator that returns the matrix cell at the given index.
Definition: mat3.h:330
static Mat3< Type > translate(const Vec2< Type > &xy)
Create a 2d translation matrix.
Definition: mat3.h:206
Mat3< Type > operator+(const Mat3< Type > &add_matrix) const
Addition operator.
static Mat3< Type > translate(Type x, Type y)
Create a 2d translation matrix.
Type z
Definition: vec3.h:82
Type y
Definition: vec2.h:81