Add Matrix4 Inverse and Transpose

Transpose is easy, with a bool flag to determine whether to access elements in row-major or column-major format. Inverse is more difficult, so this change only does translation inverses.
This commit is contained in:
Eryn Wells 2014-08-10 16:57:34 -07:00
parent 5b25b402c7
commit 4d4dc91ff4
3 changed files with 99 additions and 4 deletions

View file

@ -293,3 +293,21 @@ TEST_F(Matrix4Test, IdentityVectorMultiplication)
EXPECT_EQ(p1.Y(), v1.Y());
EXPECT_EQ(p1.Z(), v1.Z());
}
TEST_F(Matrix4Test, Transpose)
{
Matrix4 t1 = Transposed(m1);
for (UInt i = 0; i < 4; i++) {
for (UInt j = 0; j < 4; j++) {
EXPECT_EQ(m1(i,j), t1(j,i));
}
}
t1.Transpose();
for (UInt i = 0; i < 4; i++) {
for (UInt j = 0; j < 4; j++) {
EXPECT_EQ(m1(i,j), t1(i,j));
}
}
}