[]
This commit is contained in:
@@ -89,13 +89,30 @@ SCENARIO("Computing a point from a distance", "[features/rays.feature]")
|
|||||||
|
|
||||||
SCENARIO("A ray intersects a sphere at two points", "[features/spheres.feature]")
|
SCENARIO("A ray intersects a sphere at two points", "[features/spheres.feature]")
|
||||||
{
|
{
|
||||||
Ray r(Tuple::Point(0, 0, -5), Tuple::Vector(0, 0, 1));
|
GIVEN("r <- ray(point(0, 0, -5), vector(0, 0, 1))")
|
||||||
Sphere s;
|
{
|
||||||
Intersections xs = s.intersect(r);
|
Ray r(Tuple::Point(0, 0, -5), Tuple::Vector(0, 0, 1));
|
||||||
|
AND_GIVEN("s <- sphere()")
|
||||||
REQUIRE(xs.count() == 2);
|
{
|
||||||
REQUIRE(xs[0].distance_t() == 4.0);
|
Sphere s;
|
||||||
REQUIRE(xs[1].distance_t() == 6.0);
|
WHEN("xs <- intersect(s,r)")
|
||||||
|
{
|
||||||
|
Intersections xs = s.intersect(r);
|
||||||
|
THEN("xs.count = 2")
|
||||||
|
{
|
||||||
|
REQUIRE(xs.count() == 2);
|
||||||
|
}
|
||||||
|
AND_THEN("xs[0] = 4.0")
|
||||||
|
{
|
||||||
|
REQUIRE(xs[0].distance_t() == 4.0);
|
||||||
|
}
|
||||||
|
AND_THEN("xs[1 = 6.0")
|
||||||
|
{
|
||||||
|
REQUIRE(xs[1].distance_t() == 6.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|||||||
Reference in New Issue
Block a user