1 #include <msp/geometry/circle.h>
2 #include <msp/linal/vector2.h>
3 #include <msp/test/test.h>
7 class HyperSphereTests: public Test::RegisteredTest<HyperSphereTests>
12 static const char *get_name() { return "HyperSphere"; }
15 void ray_intersection();
18 HyperSphereTests::HyperSphereTests()
20 add(&HyperSphereTests::ray_intersection, "Ray intersection");
23 void HyperSphereTests::ray_intersection()
25 Geometry::Circle<double> circle(1.5);
26 Geometry::Ray<double, 2> ray(LinAl::Vector2<double>(2.5, 0), LinAl::Vector2<double>(-1, 0));
27 EXPECT(circle.check_intersection(ray));
28 ray = Geometry::Ray<double, 2>(LinAl::Vector2<double>(2.5, 0), LinAl::Vector2<double>(1, 0));
29 EXPECT(!circle.check_intersection(ray));
30 ray = Geometry::Ray<double, 2>(LinAl::Vector2<double>(2.5, 0), LinAl::Vector2<double>(-4, 2.95));
31 EXPECT(circle.check_intersection(ray));
32 ray = Geometry::Ray<double, 2>(LinAl::Vector2<double>(2.5, 0), LinAl::Vector2<double>(-4, 3.05));
33 EXPECT(!circle.check_intersection(ray));