[FEAT] Add shearing matrix transform
This commit is contained in:
@@ -151,3 +151,53 @@ TEST_CASE("[04][Trans] Rotating a point around the z axis", "[Matrix]")
|
||||
REQUIRE(half_quarter * p == Tuple::Point(-sqrt(2) / 2, sqrt(2) / 2, 0));
|
||||
REQUIRE(full_quarter * p == Tuple::Point(-1, 0, 0));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[04][Trans] A shearing transformation moves x in proportion to y", "[Matrix]")
|
||||
{
|
||||
Matrix transform = Matrix::shearing(1, 0, 0, 0, 0, 0);
|
||||
Tuple p = Tuple::Point(2, 3, 4);
|
||||
|
||||
REQUIRE(transform * p == Tuple::Point(5, 3, 4));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[04][Trans] A shearing transformation moves y in proportion to x", "[Matrix]")
|
||||
{
|
||||
Matrix transform = Matrix::shearing(0, 0, 1, 0, 0, 0);
|
||||
Tuple p = Tuple::Point(2, 3, 4);
|
||||
|
||||
REQUIRE(transform * p == Tuple::Point(2, 5, 4));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[04][Trans] A shearing transformation moves y in proportion to z", "[Matrix]")
|
||||
{
|
||||
Matrix transform = Matrix::shearing(0, 0, 0, 1, 0, 0);
|
||||
Tuple p = Tuple::Point(2, 3, 4);
|
||||
|
||||
REQUIRE(transform * p == Tuple::Point(2, 7, 4));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[04][Trans] A shearing transformation moves z in proportion to x", "[Matrix]")
|
||||
{
|
||||
Matrix transform = Matrix::shearing(0, 0, 0, 0, 1, 0);
|
||||
Tuple p = Tuple::Point(2, 3, 4);
|
||||
|
||||
REQUIRE(transform * p == Tuple::Point(2, 3, 6));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
TEST_CASE("[04][Trans] A shearing transformation moves z in proportion to y", "[Matrix]")
|
||||
{
|
||||
Matrix transform = Matrix::shearing(0, 0, 0, 0, 0, 1);
|
||||
Tuple p = Tuple::Point(2, 3, 4);
|
||||
|
||||
REQUIRE(transform * p == Tuple::Point(2, 3, 7));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user