52 m[0][0] = 1;
m[0][1] = 0;
53 m[1][0] = 0;
m[1][1] = 1;
66 Matrix2x2(
float a11,
float a12,
float a21,
float a22) {
67 m[0][0] = a11;
m[0][1] = a12;
68 m[1][0] = a21;
m[1][1] = a22;
79 m[0][0] + other.
m[0][0],
m[0][1] + other.
m[0][1],
80 m[1][0] + other.
m[1][0],
m[1][1] + other.
m[1][1]
92 m[0][0] - other.
m[0][0],
m[0][1] - other.
m[0][1],
93 m[1][0] - other.
m[1][0],
m[1][1] - other.
m[1][1]
105 m[0][0] * other.
m[0][0] +
m[0][1] * other.
m[1][0],
m[0][0] * other.
m[0][1] +
m[0][1] * other.
m[1][1],
106 m[1][0] * other.
m[0][0] +
m[1][1] * other.
m[1][0],
m[1][0] * other.
m[0][1] +
m[1][1] * other.
m[1][1]
118 m[0][0] * scalar,
m[0][1] * scalar,
119 m[1][0] * scalar,
m[1][1] * scalar
129 return m[0][0] *
m[1][1] -
m[0][1] *
m[1][0];
143 float invDet = 1.0f / det;
145 m[1][1] * invDet, -
m[0][1] * invDet,
146 -
m[1][0] * invDet,
m[0][0] * invDet
float determinant() const
Calculates the determinant of the matrix.
Matrix2x2 operator*(const Matrix2x2 &other) const
Multiplies this matrix by another matrix.
Matrix2x2 inverse() const
Calculates the inverse of the matrix.
Matrix2x2 operator+(const Matrix2x2 &other) const
Adds another matrix to this matrix.
Matrix2x2()
Default constructor.
Matrix2x2 operator-(const Matrix2x2 &other) const
Subtracts another matrix from this matrix.
Matrix2x2 operator*(float scalar) const
Multiplies this matrix by a scalar.
float m[2][2]
The elements of the matrix.
Matrix2x2(float a11, float a12, float a21, float a22)
Parameterized constructor.