43 :
Tuple<float>(dim* dim)
47 for (
int i = 0; i < this->
m_dim; i++)
48 this->
m_data[i * this->m_dim + i] = 1;
66 for (
int i = 0; i <
size; i++)
77 for (
int i = 0; i <
size; i++)
87 auto b = other.
data();
90 auto t =
new float[
size] {};
91 int dim = this->
m_dim;
92 for (
int i = 0; i < dim; i++)
93 for (
int j = 0; j < dim; j++)
94 for (
int k = 0; k < dim; k++)
95 t[i * dim + j] += a[k * dim + j] * b[i * dim + k];
97 for (
int i = 0; i <
size; i++)
109 for (
int i = 0; i <
size; i++)
110 v.data()[i] = this->
m_data[i] + other.data()[i];
119 for (
int i = 0; i <
size; i++)
120 v.data()[i] = this->
m_data[i] - other.data()[i];
129 auto b = other.data();
133 for (
int i = 0; i <
size; i++)
136 int dim = this->
m_dim;
137 for (
int i = 0; i < dim; i++)
138 for (
int j = 0; j < dim; j++)
139 for (
int k = 0; k < dim; k++)
140 c[i * dim + j] += a[k * dim + j] * b[i * dim + k];
147 for (
int i = 0; i < this->
m_size; i++)
149 for (
int i = 0; i < this->
m_dim; i++)
150 this->
m_data[i * this->m_dim + i] = 1;
156 int dim = this->
m_dim;
157 for (
int i = 0; i < dim; i++)
158 for (
int j = 0; j < i; j++)
160 float t =
data[i * dim + j];
161 data[i * dim + j] =
data[j * dim + i];
162 data[j * dim + i] = t;
177 float e10,
float e11);
189 void set(
float e00,
float e01,
190 float e10,
float e11);
202 float e10,
float e11,
float e12,
203 float e20,
float e21,
float e22);
217 void set(
float e00,
float e01,
float e02,
218 float e10,
float e11,
float e12,
219 float e20,
float e21,
float e22);
233 Matrix4f(
float e00,
float e01,
float e02,
float e03,
234 float e10,
float e11,
float e12,
float e13,
235 float e20,
float e21,
float e22,
float e23,
236 float e30,
float e31,
float e32,
float e33);
257 void set(
float e00,
float e01,
float e02,
float e03,
258 float e10,
float e11,
float e12,
float e13,
259 float e20,
float e21,
float e22,
float e23,
260 float e30,
float e31,
float e32,
float e33);
The Matrix2f class is 2 X 2 matrix.
Definition matrix.h:169
Matrix2f(float e00, float e01, float e10, float e11)
Constructs a 2 X 2 matrix objects, and sets the elements with the input fload parameters.
void set(float e00, float e01, float e10, float e11)
Sets the elements of this 2 x 2 matrix object.
Matrix2f(const Matrix2f &other)
Constructs a 2 X 2 matrix object by copying the elements of another 2 X 2 matrix.
Matrix2f(const Matrix3f &other)
Constructs a 2 X 2 matrix object by copying the elements of the 2 X 2 submatrix of another 3 X 3 matr...
Matrix2f(const Vector2f &c0, const Vector2f &c1)
Constructs a 2 X 2 matrix object by setting the vector c0 to the first column and c1 to the second co...
Matrix2f(const Matrix4f &other)
Constructs a 2 X 2 matrix object by copying the elements of the 2 X 2 submatrix of another 4 X 4 matr...
Matrix2f()
Constructs a 2 X 2 matrix objects, initializing elements on the diagonal to 1 and all others to 0.
The Matrix3f class is 3 X 3 matrix.
Definition matrix.h:194
Matrix3f(const Matrix2f &other)
Constructs a 3 X 3 matrix object, and sets its 2 X 2 submatrix with another 2 X 2 matrix,...
Matrix3f(float e00, float e01, float e02, float e10, float e11, float e12, float e20, float e21, float e22)
Constructs a 3 X 3 matrix objects, and sets the elements with the input fload parameters.
Matrix3f(const Vector3f &c0, const Vector3f &c1, const Vector3f &c2)
Constructs a 3 X 3 matrix object by setting the vector c0 to the first column, c1 to the second colum...
Matrix3f(const Matrix3f &other)
Constructs a 3 X 3 matrix object by copying the elements of another 3 X 3 matrix.
Matrix3f(const Matrix4f &other)
Constructs a 3 X 3 matrix object by copying the elements of the 3 X 3 submatrix of another 4 X 4 matr...
bool invert()
Inverts this matrix. Returns a boolean value of true if success(non-singular). If the determinant is ...
float determinant() const
Returns the determinant of the Matrix3f object.
Matrix3f()
Constructs a 3 X 3 matrix objects, initializing elements on the diagonal to 1 and all others to 0.
void set(float e00, float e01, float e02, float e10, float e11, float e12, float e20, float e21, float e22)
Sets the elements of this 3 X 3 matrix object.
The Matrix4f class is 4 X 4 matrix.
Definition matrix.h:226
Matrix4f(const Matrix4f &other)
Constructs a 4 X 4 matrix object by copying the elements of another 4 X 4 matrix.
Vector4f operator*(const Vector4f &other) const
Returns a new Vector4 object that is formed by multiplication between this Matrix and a Vector4 objec...
Matrix4f(const Vector4f &c0, const Vector4f &c1, const Vector4f &c2, const Vector4f &c3)
Constructs a 4 X 4 matrix object by setting the vector c0 to the first column, c1 to the second colum...
Quaternion toRotation() const
Extracts the rotation quaternion from this matrix object.
void translate(const Vector3f &t)
Translates this matrix by the specified vector3.
static Matrix4f fromRotation(const Quaternion &r)
Returns a 4 X 4 matrix objects representing a rotation around an axis by a specified angle.
void rotate(const Quaternion &r)
Rotates this matrix by the specified quaternion.
static Matrix4f fromTranslation(const Vector3f &t)
Returns a 4 X 4 matrix objects representing a translation by vector3.
Matrix4f(const Matrix2f &other)
Constructs a 4 X 4 matrix object, and sets its 2 X 2 submatrix with another 2 X 2 matrix,...
Matrix4f(float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
Constructs a 4 X 4 matrix objects, and sets the elements with the input fload parameters.
Matrix4f()
Constructs a 4 X 4 matrix objects, initializing elements on the diagonal to 1 and all others to 0.
void set(float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
Sets the elements of this 4 X 4 matrix object.
Matrix4f operator*(const Matrix4f &other) const
Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and an...
bool invert()
Inverts this matrix. Returns a boolean value of true if success(non-singular). If the determinant is ...
static Matrix4f fromScaling(const Vector3f &s)
Returns a 4 X 4 matrix objects representing a scaling transformation by vector3.
Vector3f toTranslation() const
Extracts the translation vector3 object from this matrix object.
Matrix4f(const Matrix3f &other)
Constructs a 4 X 4 matrix object, and sets its 3 X 3 submatrix with another 3 X 3 matrix,...
Vector3f toScaling() const
Extracts the scaling vector3 object from this matrix4 object.
float determinant() const
Returns the determinant of the Matrix4f object.
void scale(const Vector3f &s)
Scales this matrix by the specified vector3.
The templated class Matrix inherits from the templated class Tuple which is being instantiated with a...
Definition matrix.h:36
S operator+(const S &other) const
Returns a new Matrix object that is formed by element-wise addition between the current matrix and an...
Definition matrix.h:105
float * operator[](int index)
Returns a pointer to the first element in the column of index of this matrix, providing a read-write ...
Definition matrix.h:56
Matrix & operator+=(const Matrix &other)
Performs element-wise addition between the current Matrix and another matrix.
Definition matrix.h:63
void setIdentity()
Sets elements on the diagonal of this matrix to 1 and all others to 0.
Definition matrix.h:145
Matrix< S > & operator-=(const Matrix &other)
Performs element-wise subtraction between the current Matrix and another matrix.
Definition matrix.h:74
Matrix(int dim)
Constructs a dim X dim Matrix object, initializing elements on the diagonal to 1 and all others to 0.
Definition matrix.h:42
int m_dim
The dimension of the Matrix.
Definition matrix.h:38
const float * operator[](int index) const
Returns a constant pointer to the first element in the column of index of this matrix,...
Definition matrix.h:51
S operator-(const S &other) const
Returns a new Matrix object that is formed by element-wise subtraction between the current matrix and...
Definition matrix.h:115
Matrix< S > & operator*=(const Matrix &other)
Performs right matrix multiplication of the current matrix with another matrix.
Definition matrix.h:84
void transpose()
Transpose this matrix.
Definition matrix.h:153
S operator*(const S &other) const
Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and an...
Definition matrix.h:125
The Quaternion class inherits from the Tuple class, specilizing the templated parameter to float for ...
Definition quaternion.h:28
The Tuple is a templated class inheriting from the most basic class Variant.
Definition tuple.h:27
T * data()
Gets the data array of the Tuple.
Definition tuple.h:60
int m_size
Definition tuple.h:36
float * m_data
Definition tuple.h:35
int size() const
Definition tuple.h:54
The class Vector2f inherits from the templated class of Vector2, and the template parameters are spec...
Definition vector.h:268
The class Vector3f inherits from the templated class of Vector3, and the template parameters are spec...
Definition vector.h:322
The class Vector4f inherits from the templated class of Vector4, and the template parameters are spec...
Definition vector.h:366