[FEAT] Add identity matrix
This commit is contained in:
@@ -171,3 +171,26 @@ TEST_CASE("[Matrix] a matrix multiplied by a tuple", "[Matrix]")
|
||||
|
||||
REQUIRE((a * b) == Tuple(18, 24, 33, 1));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[Matrix] Multiplying a matrix by the identity matrix", "[Matrix]")
|
||||
{
|
||||
Matrix a = {
|
||||
{0, 1, 2, 4},
|
||||
{1, 2, 4, 8},
|
||||
{2, 4, 8, 16},
|
||||
{4, 8, 16, 32}
|
||||
};
|
||||
|
||||
REQUIRE((a * Matrix::identity()) == a);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[Matrix] Multiplying the identity matrix by a tuple", "[Matrix]")
|
||||
{
|
||||
Tuple a(1, 2, 3, 4);
|
||||
|
||||
REQUIRE((Matrix::identity() * a) == a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user