1 #include "GeometryTest.hpp"
3 #include "model/geometry.hpp"
7 CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::GeometryTest);
13 void GeometryTest::setUp() {
16 void GeometryTest::tearDown() {
20 void GeometryTest::testRayAABBIntersection() {
21 Ray ray{ { 0, 0, 0 }, { 1, 0, 0 } }; // at origin, pointing right
22 AABB box{ { -1, -1, -1 }, { 1, 1, 1 } }; // 2x2x2 cube centered around origin
23 glm::mat4 M(1); // no transformation
25 const float delta = std::numeric_limits<float>::epsilon();
30 CPPUNIT_ASSERT_MESSAGE(
31 "ray at origin not intersecting box at origin",
32 Intersection(ray, box, M, &distance, &normal)
34 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
35 "intersection distance way off",