From: Daniel Karbach Date: Mon, 18 Dec 2017 09:17:04 +0000 (+0100) Subject: use matrix translations in ray/sphere test X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=commitdiff_plain;h=99bac662c454fcf3680fa9c080c90e24319d8d3d use matrix translations in ray/sphere test because, why not --- diff --git a/tst/math/IntersectTest.cpp b/tst/math/IntersectTest.cpp index f428aaa..904d682 100644 --- a/tst/math/IntersectTest.cpp +++ b/tst/math/IntersectTest.cpp @@ -258,7 +258,7 @@ void IntersectTest::testRaySphereIntersection() { ); // corner case: ray origin exactly on sphere (should "intersect") - ray.Origin({ 1.0, 0.0, 0.0 }); + ray = glm::translate(glm::dvec3(0.5, 0, 0)) * ray; CPPUNIT_ASSERT_MESSAGE( "ray touching sphere does not intersect it", Intersect(ray, sphere, normal, dist) @@ -296,6 +296,7 @@ void IntersectTest::testRaySphereIntersection() { // should be 5 units apart, minus one for the radius ray.Origin({ 0.0, 4.0, 0.0 }); ray.Direction(glm::normalize(glm::dvec3(3.0, -4.0, 0.0))); + sphere = glm::translate(glm::dvec3(3.0, 0, 0)) * sphere; sphere.origin = { 3.0, 0.0, 0.0 }; CPPUNIT_ASSERT_MESSAGE( "diagonal ray does not intersect sphere",