Skip to content

Commit e349bc5

Browse files
committed
more update
1 parent 83f72fd commit e349bc5

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

ZEngine/ZEngine/Core/Maths/Matrix.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace ZEngine::Core::Maths
2929
{
3030
for (size_t i = 0; i < R; i++)
3131
{
32-
result[i][j] = other[i][j] + (*this)[i][j];
32+
result(i, j) = other(i, j) + (*this)(i, j);
3333
}
3434
}
3535
return result;
@@ -42,7 +42,7 @@ namespace ZEngine::Core::Maths
4242
{
4343
for (size_t i = 0; i < R; i++)
4444
{
45-
result[i][j] = (*this)[i][j] - other[i][j];
45+
result(i, j) = (*this)(i, j) - other(i, j);
4646
}
4747
}
4848
return result;
@@ -72,7 +72,7 @@ namespace ZEngine::Core::Maths
7272
this->m_data[i] = other.m_data[i];
7373
}
7474

75-
T determinant() const
75+
T Determinant() const
7676
{
7777
return this->m_data[0] * this->m_data[3] - this->m_data[1] * this->m_data[2];
7878
}
@@ -145,7 +145,7 @@ namespace ZEngine::Core::Maths
145145
}
146146
Mat2 Inverse()
147147
{
148-
T det = this->determinant();
148+
T det = this->Determinant();
149149
ZENGINE_VALIDATE_ASSERT(det != 0, "Matrix is singular and cannot be inverted");
150150

151151
T invDet = 1 / det;
@@ -182,7 +182,7 @@ namespace ZEngine::Core::Maths
182182
this->m_data[i] = other.m_data[i];
183183
}
184184

185-
T determinant() const
185+
T Determinant() const
186186
{
187187
return this->m_data[0] * (this->m_data[4] * this->m_data[8] - this->m_data[5] * this->m_data[7]) - this->m_data[1] * (this->m_data[3] * this->m_data[8] - this->m_data[5] * this->m_data[6]) + this->m_data[2] * (this->m_data[3] * this->m_data[7] - this->m_data[4] * this->m_data[6]);
188188
}
@@ -255,7 +255,7 @@ namespace ZEngine::Core::Maths
255255

256256
Mat3 Inverse()
257257
{
258-
T det = this->determinant();
258+
T det = this->Determinant();
259259
ZENGINE_VALIDATE_ASSERT(det != 0, "Matrix is singular and cannot be inverted");
260260

261261
T invDet = 1 / det;
@@ -375,7 +375,7 @@ namespace ZEngine::Core::Maths
375375
return *this;
376376
}
377377

378-
T determinant() const
378+
T Determinant() const
379379
{
380380
return (
381381
this->m_data[0] * (this->m_data[5] * (this->m_data[10] * this->m_data[15] - this->m_data[11] * this->m_data[14]) - this->m_data[6] * (this->m_data[9] * this->m_data[15] - this->m_data[11] * this->m_data[13]) + this->m_data[7] * (this->m_data[9] * this->m_data[14] - this->m_data[10] * this->m_data[13])) -

ZEngine/tests/Maths/Matrix_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ TEST(MatrixTest, ArithmeticOpsFloat)
4747
TEST(MatrixTest, DeterminantFloat)
4848
{
4949
Mat2f m2(1.0f, 2.0f, 3.0f, 4.0f);
50-
EXPECT_NEAR(m2.determinant(), -2.0f, EPSILON);
50+
EXPECT_NEAR(m2.Determinant(), -2.0f, EPSILON);
5151

5252
Mat3f m3(1, 2, 3, 0, 1, 4, 5, 6, 0);
53-
EXPECT_NEAR(m3.determinant(), 1.0f, EPSILON);
53+
EXPECT_NEAR(m3.Determinant(), 1.0f, EPSILON);
5454

5555
Mat4f m4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
56-
EXPECT_NEAR(m4.determinant(), 1.0f, EPSILON);
56+
EXPECT_NEAR(m4.Determinant(), 1.0f, EPSILON);
5757
}
5858

5959
TEST(MatrixTest, Identity)

0 commit comments

Comments
 (0)