]> git.localhorst.tv Git - blobs.git/commitdiff
use matrix translations in ray/sphere test
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 18 Dec 2017 09:17:04 +0000 (10:17 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 18 Dec 2017 09:17:04 +0000 (10:17 +0100)
because, why not

tst/math/IntersectTest.cpp

index f428aaa59a585ce0f3a84f941ff8df12fe23b3e2..904d682325d89915c8a08d042fa68d82879d75eb 100644 (file)
@@ -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",