From abba6aab7f46d4f225437b2f555ac8d32ced0353 Mon Sep 17 00:00:00 2001
From: Aaron Grabowy <aaron.grabowy@rwth-aachen.de>
Date: Fri, 20 Nov 2020 02:20:05 +0100
Subject: [PATCH] Added tests for inf_cone and inf_cylinder

---
 extern/typed-geometry                        | 2 +-
 tests/feature/intersections/ray-intersect.cc | 9 ++++++++-
 tests/feature/objects/any_point.cc           | 2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/extern/typed-geometry b/extern/typed-geometry
index b2642eb..05a2576 160000
--- a/extern/typed-geometry
+++ b/extern/typed-geometry
@@ -1 +1 @@
-Subproject commit b2642eb7a1630106a71bf50e46ba6599830e226b
+Subproject commit 05a25760acd58e2a87d3627a2f6d3d9f40ecc95e
diff --git a/tests/feature/intersections/ray-intersect.cc b/tests/feature/intersections/ray-intersect.cc
index fcae29d..0c79c41 100644
--- a/tests/feature/intersections/ray-intersect.cc
+++ b/tests/feature/intersections/ray-intersect.cc
@@ -100,6 +100,7 @@ TG_FUZZ_TEST(TypedGeometry, Intersections)
 
     const auto r = uniform(rng, 0.0f, 10.0f);
     const auto h = uniform(rng, 0.0f, 10.0f);
+    const auto a = uniform(rng, 5_deg, 180_deg); // sensible range for a convex inf_cone
     const auto n1 = tg::uniform<tg::dir1>(rng);
     const auto n2 = tg::uniform<tg::dir2>(rng);
     const auto n3 = tg::uniform<tg::dir3>(rng);
@@ -168,6 +169,8 @@ TG_FUZZ_TEST(TypedGeometry, Intersections)
     test_obj_and_boundary(ray3, tg::capsule3(axis0, r));
     // cylinder
     test_obj_and_boundary_no_caps(ray3, tg::cylinder<3, float>(axis0, r));
+    // ellipse
+    test_obj(ray3, tg::ellipse2in3(pos30, m23));
     // halfspace
     test_solid_obj(ray1, tg::halfspace1(n1, h));
     test_solid_obj(ray2, tg::halfspace2(n2, h));
@@ -178,8 +181,12 @@ TG_FUZZ_TEST(TypedGeometry, Intersections)
     test_obj_and_boundary_no_caps(ray2, tg::hemisphere2(pos20, r, n2));
     test_obj_and_boundary_no_caps(ray3, tg::hemisphere3(pos30, r, n3));
     // test_obj_and_boundary_no_caps(ray4, tg::hemisphere4(pos40, r, n4));
+    // inf_cone
+    test_obj_and_boundary(ray2, tg::inf_cone2(pos20, n2, a));
+    test_obj_and_boundary(ray3, tg::inf_cone3(pos30, n3, a));
     // inf_cylinder
-    test_obj_and_boundary(ray2, tg::inf_cylinder<2, float>(tg::line2(pos20, n2), r));
+    test_obj_and_boundary(ray2, tg::inf_cylinder2(tg::line2(pos20, n2), r));
+    test_obj_and_boundary(ray3, tg::inf_cylinder3(tg::line3(pos30, n3), r));
     // line
     test_obj(ray2, tg::line2(pos20, n2));
     // plane
diff --git a/tests/feature/objects/any_point.cc b/tests/feature/objects/any_point.cc
index f1e26aa..b616a1e 100644
--- a/tests/feature/objects/any_point.cc
+++ b/tests/feature/objects/any_point.cc
@@ -103,8 +103,10 @@ TG_FUZZ_TEST(TypedGeometry, AnyPoint)
     test_obj_and_boundary_no_caps(tg::hemisphere3(pos30, r, n3));
     // test_obj_and_boundary_no_caps(tg::hemisphere4(pos40, r, n4));
     // inf_cone
+    test_obj_and_boundary(tg::inf_cone2(pos20, n2, a));
     test_obj_and_boundary(tg::inf_cone3(pos30, n3, a));
     // inf_cylinder
+    test_obj_and_boundary(tg::inf_cylinder2(tg::line2(pos20, n2), r));
     test_obj_and_boundary(tg::inf_cylinder3(tg::line3(pos30, n3), r));
     // line
     test_obj(tg::line1(pos10, n1));
-- 
GitLab