From 8292ac9a3e26fb3b35414a4a498992edab5618ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 7 Jun 2018 12:51:16 +0200 Subject: [PATCH] Math/Geometry: added a missing test case. --- src/Magnum/Math/Geometry/Test/IntersectionTest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Magnum/Math/Geometry/Test/IntersectionTest.cpp b/src/Magnum/Math/Geometry/Test/IntersectionTest.cpp index 72ead75ad..5ffac6ea9 100644 --- a/src/Magnum/Math/Geometry/Test/IntersectionTest.cpp +++ b/src/Magnum/Math/Geometry/Test/IntersectionTest.cpp @@ -230,6 +230,9 @@ void IntersectionTest::pointCone() { auto surface = Matrix4::rotation(0.5f*angle, axis).transformVector(normal); /* Normal on the curved surface */ auto sNormal = Matrix4::rotation(90.0_degf, axis).transformVector(surface); + /* Same for Double precision */ + auto axisDouble = Math::cross(Vector3d::yAxis(), normalDouble).normalized(); + auto surfaceDouble = Matrix4d::rotation(0.5*angleDouble, axisDouble).transformVector(normalDouble); /* Point on edge */ CORRADE_VERIFY(Intersection::pointCone(center, center, normal, angle)); @@ -240,6 +243,12 @@ void IntersectionTest::pointCone() { CORRADE_VERIFY(!Intersection::pointCone(center + 5.0f*surface + 0.01f*sNormal, center, normal, angle)); /* Point behind the cone plane */ CORRADE_VERIFY(!Intersection::pointCone(-normal, center, normal, angle)); + + /* Point touching cone */ + { + CORRADE_EXPECT_FAIL("Point touching cone fails, possibly because of precision."); + CORRADE_VERIFY(Intersection::pointCone(centerDouble, centerDouble + surfaceDouble, normalDouble, angleDouble)); + } } void IntersectionTest::pointDoubleCone() {