1 #include <msp/geometry/circle.h>
2 #include <msp/test/test.h>
6 class HyperSphereTests: public Test::RegisteredTest<HyperSphereTests>
11 static const char *get_name() { return "HyperSphere"; }
14 void ray_intersection();
17 HyperSphereTests::HyperSphereTests()
19 add(&HyperSphereTests::ray_intersection, "Ray intersection");
22 void HyperSphereTests::ray_intersection()
24 Geometry::Circle<double> circle(1.5);
25 Geometry::Ray<double, 2> ray(LinAl::Vector<double, 2>(2.5, 0), LinAl::Vector<double, 2>(-1, 0));
26 EXPECT(circle.check_intersection(ray));
27 ray = Geometry::Ray<double, 2>(LinAl::Vector<double, 2>(2.5, 0), LinAl::Vector<double, 2>(1, 0));
28 EXPECT(!circle.check_intersection(ray));
29 ray = Geometry::Ray<double, 2>(LinAl::Vector<double, 2>(2.5, 0), LinAl::Vector<double, 2>(-4, 2.95));
30 EXPECT(circle.check_intersection(ray));
31 ray = Geometry::Ray<double, 2>(LinAl::Vector<double, 2>(2.5, 0), LinAl::Vector<double, 2>(-4, 3.05));
32 EXPECT(!circle.check_intersection(ray));