1 #include <msp/geometry/box.h>
2 #include <msp/test/test.h>
6 class HyperBoxTests: public Test::RegisteredTest<HyperBoxTests>
11 static const char *get_name() { return "HyperBox"; }
14 void ray_intersection();
17 HyperBoxTests::HyperBoxTests()
19 add(&HyperBoxTests::ray_intersection, "Ray intersection");
22 void HyperBoxTests::ray_intersection()
24 Geometry::Box<double> box(2, 4, 3);
25 Geometry::Ray<double, 3> ray(LinAl::Vector<double, 3>(10, 0, 0), LinAl::Vector<double, 3>(-1, 0, 0));
26 EXPECT(box.check_intersection(ray));
27 ray = Geometry::Ray<double, 3>(LinAl::Vector<double, 3>(10, 0, 0), LinAl::Vector<double, 3>(1, 0, 0));
28 EXPECT(!box.check_intersection(ray));
29 ray = Geometry::Ray<double, 3>(LinAl::Vector<double, 3>(9, 0, 11.45), LinAl::Vector<double, 3>(-1, 0, -1));
30 EXPECT(box.check_intersection(ray));
31 ray = Geometry::Ray<double, 3>(LinAl::Vector<double, 3>(9, 0, 11.55), LinAl::Vector<double, 3>(-1, 0, -1));
32 EXPECT(!box.check_intersection(ray));