From b2984ef17e37ba0254d08f047e4c3ff86757e83e Mon Sep 17 00:00:00 2001 From: Jeongseok Lee <jslee02@gmail.com> Date: Wed, 15 Apr 2015 01:36:19 -0400 Subject: [PATCH] Add (GJK) sphere-capsule test --- test/test_fcl_geometric_shapes.cpp | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/test_fcl_geometric_shapes.cpp b/test/test_fcl_geometric_shapes.cpp index 5b99e53d..f6b34d17 100644 --- a/test/test_fcl_geometric_shapes.cpp +++ b/test/test_fcl_geometric_shapes.cpp @@ -2827,6 +2827,52 @@ BOOST_AUTO_TEST_CASE(shapeIntersectionGJK_spherebox) // testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, true, NULL, NULL, &normal); } +BOOST_AUTO_TEST_CASE(shapeIntersectionGJK_spherecapsule) +{ + Sphere s1(20); + Capsule s2(5, 10); + + Transform3f tf1; + Transform3f tf2; + + Transform3f transform; + generateRandomTransform(extents, transform); + + // Vec3f point; + // FCL_REAL depth; + Vec3f normal; + + tf1 = Transform3f(); + tf2 = Transform3f(); + // TODO: Need convention for normal when the centers of two objects are at same position. + testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, true, NULL, NULL, NULL); + + tf1 = transform; + tf2 = transform; + // TODO: Need convention for normal when the centers of two objects are at same position. + testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, true, NULL, NULL, NULL); + + tf1 = Transform3f(); + tf2 = Transform3f(Vec3f(24.9, 0, 0)); + normal.setValue(1, 0, 0); + testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, true, NULL, NULL, &normal); + + tf1 = transform; + tf2 = transform * Transform3f(Vec3f(24.9, 0, 0)); + normal = transform.getRotation() * Vec3f(1, 0, 0); + testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, true, NULL, NULL, &normal); + + tf1 = Transform3f(); + tf2 = Transform3f(Vec3f(25, 0, 0)); + normal.setValue(1, 0, 0); + testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, true, NULL, NULL, &normal); + + tf1 = transform; + tf2 = transform * Transform3f(Vec3f(25.1, 0, 0)); + normal = transform.getRotation() * Vec3f(1, 0, 0); + testShapeInersection(s1, tf1, s2, tf2, GST_INDEP, false); +} + BOOST_AUTO_TEST_CASE(shapeIntersectionGJK_cylindercylinder) { Cylinder s1(5, 10); -- GitLab