42 #include <gtest/gtest.h>
65 static std::array<S, 6> static_extents{ {0, 0, 0, 10, 10, 10} };
66 return static_extents;
73 return static_solver1;
80 return static_solver2;
100 const auto volume = 4.0 / 3.0 * pi * radius * radius * radius;
107 test_sphere_shape<double>();
110 template <
typename S>
123 S dt = 1.0 / (N - 1);
128 std::vector<bool> result1(N);
129 for(
int i = 0; i < N; ++i)
147 std::vector<bool> result2(N);
149 for(
int i = 0; i < N; ++i)
165 for(std::size_t i = 0; i < result1.size(); ++i)
174 test_gjkcache<double>();
177 template <
typename Shape1,
typename Shape2>
184 bool check_opposite_normal,
185 typename Shape1::S tol)
187 std::cout <<
"Disagreement between " << comparison_type
188 <<
" and expected_" << comparison_type <<
" for "
192 <<
"tf1.linear: \n" << tf1.linear() << std::endl
193 <<
"tf1.translation: " << tf1.translation().transpose() << std::endl
194 <<
"tf2.linear: \n" << tf2.linear() << std::endl
195 <<
"tf2.translation: " << tf2.translation().transpose() << std::endl
196 <<
"expected_" << comparison_type <<
": " << expected_contact_or_normal
197 <<
"actual_" << comparison_type <<
" : " << actual_contact_or_normal << std::endl;
199 if (check_opposite_normal)
200 std::cout <<
" or " << -expected_contact_or_normal;
202 std::cout << std::endl
203 <<
"difference: " << (actual_contact_or_normal - expected_contact_or_normal).norm() << std::endl
204 <<
"tolerance: " << tol << std::endl;
207 template <
typename Shape1,
typename Shape2>
213 typename Shape1::S actual_depth,
214 typename Shape1::S tol)
216 std::cout <<
"Disagreement between " << comparison_type
217 <<
" and expected_" << comparison_type <<
" for "
221 <<
"tf1.linear: \n" << tf1.linear() << std::endl
222 <<
"tf1.translation: " << tf1.translation().transpose() << std::endl
223 <<
"tf2.linear: \n" << tf2.linear() << std::endl
224 <<
"tf2.translation: " << tf2.translation().transpose() << std::endl
226 <<
"actual_depth : " << actual_depth << std::endl
227 <<
"difference: " << std::abs(actual_depth -
expected_depth) << std::endl
228 <<
"tolerance: " << tol << std::endl;
231 template <
typename Shape1,
typename Shape2>
236 bool check_position =
false,
237 bool check_depth =
false,
238 bool check_normal =
false,
239 bool check_opposite_normal =
false,
240 typename Shape1::S tol = 1e-9)
250 bool contact_equal = actual.
pos.isApprox(expected.
pos, tol);
264 bool normal_equal = actual.
normal.isApprox(expected.
normal, tol);
266 if (!normal_equal && check_opposite_normal)
267 normal_equal = actual.
normal.isApprox(-expected.
normal, tol);
276 template <
typename Shape1,
typename Shape2>
282 bool check_position =
false,
283 bool check_depth =
false,
284 bool check_normal =
false,
285 bool check_opposite_normal =
false,
286 typename Shape1::S tol = 1e-9)
288 using S =
typename Shape1::S;
291 bool sameNumContacts = (actual_contacts.size() == expected_contacts.size());
293 if (!sameNumContacts)
296 <<
"===== [ geometric shape collision test failure report ] ======\n"
302 <<
"tf1.linear : \n" << tf1.linear() <<
"\n"
303 <<
"tf1.translation: " << tf1.translation().transpose() <<
"\n"
307 <<
"tf2.linear : \n" << tf2.linear() <<
"\n"
308 <<
"tf2.translation: " << tf2.translation().transpose() <<
"\n"
310 <<
"The numbers of expected contacts '"
311 << expected_contacts.size()
312 <<
"' and the number of actual contacts '"
313 << actual_contacts.size()
314 <<
"' are not equal.\n"
320 const size_t numContacts = actual_contacts.size();
322 std::vector<int> index_to_actual_contacts(numContacts, -1);
323 std::vector<int> index_to_expected_contacts(numContacts, -1);
325 bool foundAll =
true;
326 for (
size_t i = 0; i < numContacts; ++i)
331 for (
size_t j = 0; j < numContacts; ++j)
333 if (index_to_expected_contacts[j] != -1)
339 s1, tf1, s2, tf2, solver_type,
343 check_normal, check_opposite_normal,
348 index_to_actual_contacts[i] = j;
349 index_to_expected_contacts[j] = i;
354 if (index_to_actual_contacts[i] == -1)
361 <<
"===== [ geometric shape collision test failure report ] ======\n"
367 <<
"tf1.linear : \n" << tf1.linear() <<
"\n"
368 <<
"tf1.translation: " << tf1.translation().transpose() <<
"\n"
372 <<
"tf2.linear : \n" << tf2.linear() <<
"\n"
373 <<
"tf2.translation: " << tf2.translation().transpose() <<
"\n"
375 <<
"[ Expected Contacts: " << numContacts <<
" ]\n";
376 for (
size_t i = 0; i < numContacts; ++i)
380 std::cout <<
"(" << i <<
") pos: " << expected.
pos.transpose() <<
", "
381 <<
"normal: " << expected.
normal.transpose() <<
", "
384 if (index_to_actual_contacts[i] != -1)
385 std::cout <<
"found, actual (" << index_to_actual_contacts[i] <<
")\n";
387 std::cout <<
"not found!\n";
390 <<
"[ Actual Contacts: " << numContacts <<
" ]\n";
391 for (
size_t i = 0; i < numContacts; ++i)
395 std::cout <<
"(" << i <<
") pos: " << actual.
pos.transpose() <<
", "
396 <<
"normal: " << actual.
normal.transpose() <<
", "
399 if (index_to_expected_contacts[i] != -1)
400 std::cout <<
"found, expected (" << index_to_expected_contacts[i] <<
")\n";
402 std::cout <<
"not found!\n";
411 template <
typename S>
415 contacts.resize(numContacts);
417 for (
size_t i = 0; i < numContacts; ++i)
421 contacts[i].pos = cnt.pos;
422 contacts[i].normal = cnt.normal;
423 contacts[i].penetration_depth = cnt.penetration_depth;
427 template <
typename Shape1,
typename Shape2>
434 bool check_position =
true,
435 bool check_depth =
true,
436 bool check_normal =
true,
437 bool check_opposite_normal =
false,
438 typename Shape1::S tol = 1e-9)
440 using S =
typename Shape1::S;
447 std::vector<ContactPoint<S>> actual_contacts;
456 res = solver1<S>().shapeIntersect(s1, tf1, s2, tf2,
nullptr);
460 res = solver2<S>().shapeIntersect(s1, tf1, s2, tf2,
nullptr);
464 std::cerr <<
"Invalid GJK solver. Test aborted." << std::endl;
472 res = solver1<S>().shapeIntersect(s1, tf1, s2, tf2, &actual_contacts);
476 res = solver2<S>().shapeIntersect(s1, tf1, s2, tf2, &actual_contacts);
480 std::cerr <<
"Invalid GJK solver. Test aborted." << std::endl;
487 expected_contacts, actual_contacts,
490 check_normal, check_opposite_normal,
499 res = (
collide(&s1, tf1, &s2, tf2, request, result) > 0);
505 res = (
collide(&s1, tf1, &s2, tf2, request, result) > 0);
511 expected_contacts, actual_contacts,
514 check_normal, check_opposite_normal,
543 template <
typename S>
555 std::vector<ContactPoint<S>> contacts;
568 contacts[0].normal << 1, 0, 0;
569 contacts[0].pos << 20, 0, 0;
570 contacts[0].penetration_depth = 0.0;
584 contacts[0].normal << 1, 0, 0;
585 contacts[0].pos << 20.0 - 0.1 * 20.0/(20.0 + 10.0), 0, 0;
586 contacts[0].penetration_depth = 0.1;
594 contacts[0].penetration_depth = 0.1;
600 contacts[0].normal.setZero();
601 contacts[0].pos.setZero();
602 contacts[0].penetration_depth = 20.0 + 10.0;
608 contacts[0].normal.setZero();
610 contacts[0].penetration_depth = 20.0 + 10.0;
616 contacts[0].normal << -1, 0, 0;
617 contacts[0].pos << -20.0 + 0.1 * 20.0/(20.0 + 10.0), 0, 0;
618 contacts[0].penetration_depth = 0.1;
626 contacts[0].penetration_depth = 0.1;
632 contacts[0].normal << -1, 0, 0;
633 contacts[0].pos << -20, 0, 0;
634 contacts[0].penetration_depth = 0.0;
646 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_spheresphere)
649 test_shapeIntersection_spheresphere<double>();
652 template <
typename S>
655 return c1[2] < c2[2];
658 template <
typename S>
661 return cp1.
pos[2] < cp2.
pos[2];
688 template <
typename Derived>
691 using S =
typename Derived::RealScalar;
697 std::vector<Vector3<S>> vertices(8);
698 vertices[0] << 1, 1, 1;
699 vertices[1] << 1, 1, -1;
700 vertices[2] << 1, -1, 1;
701 vertices[3] << 1, -1, -1;
702 vertices[4] << -1, 1, 1;
703 vertices[5] << -1, 1, -1;
704 vertices[6] << -1, -1, 1;
705 vertices[7] << -1, -1, -1;
707 for (
int i = 0; i < 8; ++i)
709 vertices[i][0] *= 0.5 * s2.
side[0];
710 vertices[i][1] *= 0.5 * s2.
side[1];
711 vertices[i][2] *= 0.5 * s2.
side[2];
717 std::vector<ContactPoint<S>> contacts;
720 bool res = solver1<S>().shapeIntersect(s1, tf1, s2, tf2, &contacts);
724 for (
int i = 0; i < 8; ++i)
725 vertices[i] = tf2 * vertices[i];
728 std::sort(vertices.begin(), vertices.end(), compareContactPointds1<S>);
729 std::sort(contacts.begin(), contacts.end(), compareContactPointds2<S>);
732 size_t numContacts = contacts.size();
733 numContacts =
std::min(
static_cast<size_t>(1), numContacts);
736 for (
size_t i = 0; i < numContacts; ++i)
743 <<
"\n\tExpected: " << contact_pos
744 <<
"\n\tFound: " << contacts[i].pos;
749 template <
typename S>
761 std::vector<ContactPoint<S>> contacts;
769 contacts[0].normal << 1, 0, 0;
770 contacts[1].normal << 1, 0, 0;
771 contacts[2].normal << 1, 0, 0;
772 contacts[3].normal << 1, 0, 0;
817 #if !defined(FCL_OS_MACOS) || !defined(NDEBUG)
819 for (
uint32 i = 0; i < numTests; ++i)
831 test_shapeIntersection_boxbox<double>();
834 template <
typename S>
838 const bool collides =
true;
839 const bool check_position =
true;
840 const bool check_depth =
true;
841 const bool check_normal =
true;
842 const bool check_opposite_normal =
false;
853 std::vector<ContactPoint<S>> contacts;
862 contacts[0].normal << -1, 0, 0;
864 !check_position, !check_depth, check_normal);
870 !check_position, !check_depth, !check_normal);
877 !check_position, !check_depth, !check_normal);
886 contacts[0].normal << 1, 0, 0;
888 !check_position, !check_depth, check_normal);
895 !check_position, !check_depth, check_normal,
896 !check_opposite_normal, 1e-4);
899 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_spherebox)
902 test_shapeIntersection_spherebox<double>();
905 template <
typename S>
917 std::vector<ContactPoint<S>> contacts;
934 contacts[0].normal << 1, 0, 0;
946 contacts[0].normal << 1, 0, 0;
965 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_spherecapsule)
968 test_shapeIntersection_spherecapsule<double>();
971 template <
typename S>
986 transform.translation() << 8.40188, 3.94383, 7.83099;
988 std::vector<ContactPoint<S>> contacts;
1005 contacts[0].normal << 1, 0, 0;
1009 #if !defined(FCL_OS_MACOS) || !defined(NDEBUG)
1016 testShapeIntersection(s1, tf1, s2, tf2,
GST_LIBCCD,
true, contacts,
false,
false,
true,
false, 1e-5);
1028 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_cylindercylinder)
1031 test_shapeIntersection_cylindercylinder<double>();
1034 template <
typename S>
1046 std::vector<ContactPoint<S>> contacts;
1063 contacts[0].normal << 1, 0, 0;
1070 testShapeIntersection(s1, tf1, s2, tf2,
GST_LIBCCD,
true, contacts,
false,
false,
true,
false, 5e-5);
1083 contacts[0].normal << 0, 0, 1;
1090 testShapeIntersection(s1, tf1, s2, tf2,
GST_LIBCCD,
true, contacts,
false,
false,
true,
false, 1e-5);
1096 test_shapeIntersection_conecone<double>();
1099 template <
typename S>
1111 std::vector<ContactPoint<S>> contacts;
1128 contacts[0].normal << 1, 0, 0;
1129 testShapeIntersection(s1, tf1, s2, tf2,
GST_LIBCCD,
true, contacts,
false,
false,
true,
false, 0.061);
1135 testShapeIntersection(s1, tf1, s2, tf2,
GST_LIBCCD,
true, contacts,
false,
false,
true,
false, 0.46);
1148 contacts[0].normal << 0, 0, 1;
1155 testShapeIntersection(s1, tf1, s2, tf2,
GST_LIBCCD,
true, contacts,
false,
false,
true,
false, 1e-4);
1169 test_shapeIntersection_cylindercone<double>();
1172 template <
typename S>
1185 std::vector<ContactPoint<S>> contacts;
1242 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_ellipsoidellipsoid)
1245 test_shapeIntersection_ellipsoidellipsoid<double>();
1248 template <
typename S>
1263 res = solver1<S>().shapeTriangleIntersect(s,
Transform3<S>::Identity(), t[0], t[1], t[2],
nullptr,
nullptr,
nullptr);
1266 res = solver1<S>().shapeTriangleIntersect(s,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
1271 t[1] << 9.9, -20, 0;
1273 res = solver1<S>().shapeTriangleIntersect(s,
Transform3<S>::Identity(), t[0], t[1], t[2],
nullptr,
nullptr,
nullptr);
1276 res = solver1<S>().shapeTriangleIntersect(s,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
1279 res = solver1<S>().shapeTriangleIntersect(s,
Transform3<S>::Identity(), t[0], t[1], t[2],
nullptr,
nullptr, &normal);
1283 res = solver1<S>().shapeTriangleIntersect(s,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr, &normal);
1288 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_spheretriangle)
1291 test_shapeIntersection_spheretriangle<double>();
1294 template <
typename S>
1314 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
1325 #if !defined(FCL_OS_MACOS) || !defined(NDEBUG)
1326 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
1335 #if !defined(FCL_OS_MACOS) || !defined(NDEBUG)
1336 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr, &normal);
1342 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_halfspacetriangle)
1345 test_shapeIntersection_halfspacetriangle<double>();
1348 template <
typename S>
1368 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
1373 t[1] << -0.1, -20, 0;
1374 t[2] << -0.1, 20, 0;
1378 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
1385 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr, &normal);
1390 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_planetriangle)
1393 test_shapeIntersection_planetriangle<double>();
1396 template <
typename S>
1408 std::vector<ContactPoint<S>> contacts;
1413 contacts[0].pos << -5, 0, 0;
1414 contacts[0].penetration_depth = 10;
1415 contacts[0].normal << -1, 0, 0;
1422 contacts[0].penetration_depth = 10;
1429 contacts[0].pos << -2.5, 0, 0;
1430 contacts[0].penetration_depth = 15;
1431 contacts[0].normal << -1, 0, 0;
1438 contacts[0].penetration_depth = 15;
1445 contacts[0].pos << -7.5, 0, 0;
1446 contacts[0].penetration_depth = 5;
1447 contacts[0].normal << -1, 0, 0;
1454 contacts[0].penetration_depth = 5;
1469 contacts[0].pos << 0.05, 0, 0;
1470 contacts[0].penetration_depth = 20.1;
1471 contacts[0].normal << -1, 0, 0;
1478 contacts[0].penetration_depth = 20.1;
1483 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_halfspacesphere)
1486 test_shapeIntersection_halfspacesphere<double>();
1489 template <
typename S>
1501 std::vector<ContactPoint<S>> contacts;
1506 contacts[0].pos.setZero();
1507 contacts[0].penetration_depth = 10;
1508 contacts[0].normal << 1, 0, 0;
1509 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
1515 contacts[0].penetration_depth = 10;
1517 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
1522 contacts[0].pos << 5, 0, 0;
1523 contacts[0].penetration_depth = 5;
1524 contacts[0].normal << 1, 0, 0;
1531 contacts[0].penetration_depth = 5;
1538 contacts[0].pos << -5, 0, 0;
1539 contacts[0].penetration_depth = 5;
1540 contacts[0].normal << -1, 0, 0;
1547 contacts[0].penetration_depth = 5;
1571 test_shapeIntersection_planesphere<double>();
1574 template <
typename S>
1586 std::vector<ContactPoint<S>> contacts;
1591 contacts[0].pos << -1.25, 0, 0;
1592 contacts[0].penetration_depth = 2.5;
1593 contacts[0].normal << -1, 0, 0;
1600 contacts[0].penetration_depth = 2.5;
1607 contacts[0].pos << -0.625, 0, 0;
1608 contacts[0].penetration_depth = 3.75;
1609 contacts[0].normal << -1, 0, 0;
1616 contacts[0].penetration_depth = 3.75;
1623 contacts[0].pos << -1.875, 0, 0;
1624 contacts[0].penetration_depth = 1.25;
1625 contacts[0].normal << -1, 0, 0;
1632 contacts[0].penetration_depth = 1.25;
1639 contacts[0].pos << 0.005, 0, 0;
1640 contacts[0].penetration_depth = 5.01;
1641 contacts[0].normal << -1, 0, 0;
1648 contacts[0].penetration_depth = 5.01;
1669 test_shapeIntersection_halfspacebox<double>();
1672 template <
typename S>
1684 std::vector<ContactPoint<S>> contacts;
1689 contacts[0].pos << 0, 0, 0;
1690 contacts[0].penetration_depth = 2.5;
1691 contacts[0].normal << 1, 0, 0;
1692 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
1698 contacts[0].penetration_depth = 2.5;
1700 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
1705 contacts[0].pos << 1.25, 0, 0;
1706 contacts[0].penetration_depth = 1.25;
1707 contacts[0].normal << 1, 0, 0;
1714 contacts[0].penetration_depth = 1.25;
1721 contacts[0].pos << -1.25, 0, 0;
1722 contacts[0].penetration_depth = 1.25;
1723 contacts[0].normal << -1, 0, 0;
1730 contacts[0].penetration_depth = 1.25;
1759 test_shapeIntersection_planebox<double>();
1762 template <
typename S>
1774 std::vector<ContactPoint<S>> contacts;
1779 contacts[0].pos << -2.5, 0, 0;
1780 contacts[0].penetration_depth = 5.0;
1781 contacts[0].normal << -1, 0, 0;
1788 contacts[0].penetration_depth = 5.0;
1795 contacts[0].pos << -1.875, 0, 0;
1796 contacts[0].penetration_depth = 6.25;
1797 contacts[0].normal << -1, 0, 0;
1804 contacts[0].penetration_depth = 6.25;
1811 contacts[0].pos << -3.125, 0, 0;
1812 contacts[0].penetration_depth = 3.75;
1813 contacts[0].normal << -1, 0, 0;
1820 contacts[0].penetration_depth = 3.75;
1827 contacts[0].pos << 0.005, 0, 0;
1828 contacts[0].penetration_depth = 10.01;
1829 contacts[0].normal << -1, 0, 0;
1836 contacts[0].penetration_depth = 10.01;
1856 contacts[0].pos << 0, -5.0, 0;
1857 contacts[0].penetration_depth = 10.0;
1858 contacts[0].normal << 0, -1, 0;
1865 contacts[0].penetration_depth = 10.0;
1872 contacts[0].pos << 0, -4.375, 0;
1873 contacts[0].penetration_depth = 11.25;
1874 contacts[0].normal << 0, -1, 0;
1881 contacts[0].penetration_depth = 11.25;
1888 contacts[0].pos << 0, -5.625, 0;
1889 contacts[0].penetration_depth = 8.75;
1890 contacts[0].normal << 0, -1, 0;
1897 contacts[0].penetration_depth = 8.75;
1904 contacts[0].pos << 0, 0.005, 0;
1905 contacts[0].penetration_depth = 20.01;
1906 contacts[0].normal << 0, -1, 0;
1913 contacts[0].penetration_depth = 20.01;
1933 contacts[0].pos << 0, 0, -10.0;
1934 contacts[0].penetration_depth = 20.0;
1935 contacts[0].normal << 0, 0, -1;
1942 contacts[0].penetration_depth = 20.0;
1949 contacts[0].pos << 0, 0, -9.375;
1950 contacts[0].penetration_depth = 21.25;
1951 contacts[0].normal << 0, 0, -1;
1958 contacts[0].penetration_depth = 21.25;
1965 contacts[0].pos << 0, 0, -10.625;
1966 contacts[0].penetration_depth = 18.75;
1967 contacts[0].normal << 0, 0, -1;
1974 contacts[0].penetration_depth = 18.75;
1981 contacts[0].pos << 0, 0, 0.005;
1982 contacts[0].penetration_depth = 40.01;
1983 contacts[0].normal << 0, 0, -1;
1990 contacts[0].penetration_depth = 40.01;
2003 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_halfspaceellipsoid)
2006 test_shapeIntersection_halfspaceellipsoid<double>();
2009 template <
typename S>
2021 std::vector<ContactPoint<S>> contacts;
2026 contacts[0].pos << 0, 0, 0;
2027 contacts[0].penetration_depth = 5.0;
2028 contacts[0].normal << -1, 0, 0;
2029 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2035 contacts[0].penetration_depth = 5.0;
2037 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2042 contacts[0].pos << 1.25, 0, 0;
2043 contacts[0].penetration_depth = 3.75;
2044 contacts[0].normal << 1, 0, 0;
2051 contacts[0].penetration_depth = 3.75;
2058 contacts[0].pos << -1.25, 0, 0;
2059 contacts[0].penetration_depth = 3.75;
2060 contacts[0].normal << -1, 0, 0;
2067 contacts[0].penetration_depth = 3.75;
2095 contacts[0].pos << 0, 0.0, 0;
2096 contacts[0].penetration_depth = 10.0;
2097 contacts[0].normal << 0, -1, 0;
2098 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2104 contacts[0].penetration_depth = 10.0;
2106 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2111 contacts[0].pos << 0, 1.25, 0;
2112 contacts[0].penetration_depth = 8.75;
2113 contacts[0].normal << 0, 1, 0;
2120 contacts[0].penetration_depth = 8.75;
2127 contacts[0].pos << 0, -1.25, 0;
2128 contacts[0].penetration_depth = 8.75;
2129 contacts[0].normal << 0, -1, 0;
2136 contacts[0].penetration_depth = 8.75;
2164 contacts[0].pos << 0, 0, 0;
2165 contacts[0].penetration_depth = 20.0;
2166 contacts[0].normal << 0, 0, -1;
2167 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2173 contacts[0].penetration_depth = 20.0;
2175 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2180 contacts[0].pos << 0, 0, 1.25;
2181 contacts[0].penetration_depth = 18.75;
2182 contacts[0].normal << 0, 0, 1;
2189 contacts[0].penetration_depth = 18.75;
2196 contacts[0].pos << 0, 0, -1.25;
2197 contacts[0].penetration_depth = 18.75;
2198 contacts[0].normal << 0, 0, -1;
2205 contacts[0].penetration_depth = 18.75;
2226 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_planeellipsoid)
2229 test_shapeIntersection_planeellipsoid<double>();
2232 template <
typename S>
2244 std::vector<ContactPoint<S>> contacts;
2249 contacts[0].pos << -2.5, 0, 0;
2250 contacts[0].penetration_depth = 5;
2251 contacts[0].normal << -1, 0, 0;
2258 contacts[0].penetration_depth = 5;
2265 contacts[0].pos << -1.25, 0, 0;
2266 contacts[0].penetration_depth = 7.5;
2267 contacts[0].normal << -1, 0, 0;
2274 contacts[0].penetration_depth = 7.5;
2281 contacts[0].pos << -3.75, 0, 0;
2282 contacts[0].penetration_depth = 2.5;
2283 contacts[0].normal << -1, 0, 0;
2290 contacts[0].penetration_depth = 2.5;
2297 contacts[0].pos << 0.05, 0, 0;
2298 contacts[0].penetration_depth = 10.1;
2299 contacts[0].normal << -1, 0, 0;
2306 contacts[0].penetration_depth = 10.1;
2326 contacts[0].pos << 0, -2.5, 0;
2327 contacts[0].penetration_depth = 5;
2328 contacts[0].normal << 0, -1, 0;
2335 contacts[0].penetration_depth = 5;
2342 contacts[0].pos << 0, -1.25, 0;
2343 contacts[0].penetration_depth = 7.5;
2344 contacts[0].normal << 0, -1, 0;
2351 contacts[0].penetration_depth = 7.5;
2358 contacts[0].pos << 0, -3.75, 0;
2359 contacts[0].penetration_depth = 2.5;
2360 contacts[0].normal << 0, -1, 0;
2367 contacts[0].penetration_depth = 2.5;
2374 contacts[0].pos << 0, 0.05, 0;
2375 contacts[0].penetration_depth = 10.1;
2376 contacts[0].normal << 0, -1, 0;
2383 contacts[0].penetration_depth = 10.1;
2403 contacts[0].pos << 0, 0, -5;
2404 contacts[0].penetration_depth = 10;
2405 contacts[0].normal << 0, 0, -1;
2412 contacts[0].penetration_depth = 10;
2419 contacts[0].pos << 0, 0, -3.75;
2420 contacts[0].penetration_depth = 12.5;
2421 contacts[0].normal << 0, 0, -1;
2428 contacts[0].penetration_depth = 12.5;
2435 contacts[0].pos << 0, 0, -6.25;
2436 contacts[0].penetration_depth = 7.5;
2437 contacts[0].normal << 0, 0, -1;
2444 contacts[0].penetration_depth = 7.5;
2451 contacts[0].pos << 0, 0, 0.05;
2452 contacts[0].penetration_depth = 20.1;
2453 contacts[0].normal << 0, 0, -1;
2460 contacts[0].penetration_depth = 20.1;
2473 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_halfspacecapsule)
2476 test_shapeIntersection_halfspacecapsule<double>();
2479 template <
typename S>
2491 std::vector<ContactPoint<S>> contacts;
2496 contacts[0].pos << 0, 0, 0;
2497 contacts[0].penetration_depth = 5;
2498 contacts[0].normal << 1, 0, 0;
2499 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2505 contacts[0].penetration_depth = 5;
2507 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2512 contacts[0].pos << 2.5, 0, 0;
2513 contacts[0].penetration_depth = 2.5;
2514 contacts[0].normal << 1, 0, 0;
2521 contacts[0].penetration_depth = 2.5;
2528 contacts[0].pos << -2.5, 0, 0;
2529 contacts[0].penetration_depth = 2.5;
2530 contacts[0].normal << -1, 0, 0;
2537 contacts[0].penetration_depth = 2.5;
2565 contacts[0].pos << 0, 0, 0;
2566 contacts[0].penetration_depth = 5;
2567 contacts[0].normal << 0, 1, 0;
2568 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2574 contacts[0].penetration_depth = 5;
2576 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2581 contacts[0].pos << 0, 2.5, 0;
2582 contacts[0].penetration_depth = 2.5;
2583 contacts[0].normal << 0, 1, 0;
2590 contacts[0].penetration_depth = 2.5;
2597 contacts[0].pos << 0, -2.5, 0;
2598 contacts[0].penetration_depth = 2.5;
2599 contacts[0].normal << 0, -1, 0;
2606 contacts[0].penetration_depth = 2.5;
2634 contacts[0].pos << 0, 0, 0;
2635 contacts[0].penetration_depth = 10;
2636 contacts[0].normal << 0, 0, 1;
2637 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2643 contacts[0].penetration_depth = 10;
2645 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2650 contacts[0].pos << 0, 0, 2.5;
2651 contacts[0].penetration_depth = 7.5;
2652 contacts[0].normal << 0, 0, 1;
2659 contacts[0].penetration_depth = 7.5;
2666 contacts[0].pos << 0, 0, -2.5;
2667 contacts[0].penetration_depth = 7.5;
2668 contacts[0].normal << 0, 0, -1;
2675 contacts[0].penetration_depth = 7.5;
2699 test_shapeIntersection_planecapsule<double>();
2702 template <
typename S>
2714 std::vector<ContactPoint<S>> contacts;
2719 contacts[0].pos << -2.5, 0, 0;
2720 contacts[0].penetration_depth = 5;
2721 contacts[0].normal << -1, 0, 0;
2728 contacts[0].penetration_depth = 5;
2735 contacts[0].pos << -1.25, 0, 0;
2736 contacts[0].penetration_depth = 7.5;
2737 contacts[0].normal << -1, 0, 0;
2744 contacts[0].penetration_depth = 7.5;
2751 contacts[0].pos << -3.75, 0, 0;
2752 contacts[0].penetration_depth = 2.5;
2753 contacts[0].normal << -1, 0, 0;
2760 contacts[0].penetration_depth = 2.5;
2767 contacts[0].pos << 0.05, 0, 0;
2768 contacts[0].penetration_depth = 10.1;
2769 contacts[0].normal << -1, 0, 0;
2776 contacts[0].penetration_depth = 10.1;
2796 contacts[0].pos << 0, -2.5, 0;
2797 contacts[0].penetration_depth = 5;
2798 contacts[0].normal << 0, -1, 0;
2805 contacts[0].penetration_depth = 5;
2812 contacts[0].pos << 0, -1.25, 0;
2813 contacts[0].penetration_depth = 7.5;
2814 contacts[0].normal << 0, -1, 0;
2821 contacts[0].penetration_depth = 7.5;
2828 contacts[0].pos << 0, -3.75, 0;
2829 contacts[0].penetration_depth = 2.5;
2830 contacts[0].normal << 0, -1, 0;
2837 contacts[0].penetration_depth = 2.5;
2844 contacts[0].pos << 0, 0.05, 0;
2845 contacts[0].penetration_depth = 10.1;
2846 contacts[0].normal << 0, -1, 0;
2853 contacts[0].penetration_depth = 10.1;
2873 contacts[0].pos << 0, 0, -2.5;
2874 contacts[0].penetration_depth = 5;
2875 contacts[0].normal << 0, 0, -1;
2882 contacts[0].penetration_depth = 5;
2889 contacts[0].pos << 0, 0, -1.25;
2890 contacts[0].penetration_depth = 7.5;
2891 contacts[0].normal << 0, 0, -1;
2898 contacts[0].penetration_depth = 7.5;
2905 contacts[0].pos << 0, 0, -3.75;
2906 contacts[0].penetration_depth = 2.5;
2907 contacts[0].normal << 0, 0, -1;
2914 contacts[0].penetration_depth = 2.5;
2921 contacts[0].pos << 0, 0, 0.05;
2922 contacts[0].penetration_depth = 10.1;
2923 contacts[0].normal << 0, 0, -1;
2930 contacts[0].penetration_depth = 10.1;
2943 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_halfspacecylinder)
2946 test_shapeIntersection_halfspacecylinder<double>();
2949 template <
typename S>
2961 std::vector<ContactPoint<S>> contacts;
2966 contacts[0].pos << 0, 0, 0;
2967 contacts[0].penetration_depth = 5;
2968 contacts[0].normal << 1, 0, 0;
2969 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2975 contacts[0].penetration_depth = 5;
2977 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
2982 contacts[0].pos << 2.5, 0, 0;
2983 contacts[0].penetration_depth = 2.5;
2984 contacts[0].normal << 1, 0, 0;
2991 contacts[0].penetration_depth = 2.5;
2998 contacts[0].pos << -2.5, 0, 0;
2999 contacts[0].penetration_depth = 2.5;
3000 contacts[0].normal << -1, 0, 0;
3007 contacts[0].penetration_depth = 2.5;
3035 contacts[0].pos << 0, 0, 0;
3036 contacts[0].penetration_depth = 5;
3037 contacts[0].normal << 0, 1, 0;
3038 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3044 contacts[0].penetration_depth = 5;
3046 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3051 contacts[0].pos << 0, 2.5, 0;
3052 contacts[0].penetration_depth = 2.5;
3053 contacts[0].normal << 0, 1, 0;
3060 contacts[0].penetration_depth = 2.5;
3067 contacts[0].pos << 0, -2.5, 0;
3068 contacts[0].penetration_depth = 2.5;
3069 contacts[0].normal << 0, -1, 0;
3076 contacts[0].penetration_depth = 2.5;
3104 contacts[0].pos << 0, 0, 0;
3105 contacts[0].penetration_depth = 5;
3106 contacts[0].normal << 0, 0, 1;
3107 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3113 contacts[0].penetration_depth = 5;
3115 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3120 contacts[0].pos << 0, 0, 2.5;
3121 contacts[0].penetration_depth = 2.5;
3122 contacts[0].normal << 0, 0, 1;
3129 contacts[0].penetration_depth = 2.5;
3136 contacts[0].pos << 0, 0, -2.5;
3137 contacts[0].penetration_depth = 2.5;
3138 contacts[0].normal << 0, 0, -1;
3145 contacts[0].penetration_depth = 2.5;
3166 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_planecylinder)
3169 test_shapeIntersection_planecylinder<double>();
3172 template <
typename S>
3184 std::vector<ContactPoint<S>> contacts;
3189 contacts[0].pos << -2.5, 0, -5;
3190 contacts[0].penetration_depth = 5;
3191 contacts[0].normal << -1, 0, 0;
3198 contacts[0].penetration_depth = 5;
3205 contacts[0].pos << -1.25, 0, -5;
3206 contacts[0].penetration_depth = 7.5;
3207 contacts[0].normal << -1, 0, 0;
3214 contacts[0].penetration_depth = 7.5;
3221 contacts[0].pos << -3.75, 0, -5;
3222 contacts[0].penetration_depth = 2.5;
3223 contacts[0].normal << -1, 0, 0;
3230 contacts[0].penetration_depth = 2.5;
3237 contacts[0].pos << 0.05, 0, -5;
3238 contacts[0].penetration_depth = 10.1;
3239 contacts[0].normal << -1, 0, 0;
3246 contacts[0].penetration_depth = 10.1;
3266 contacts[0].pos << 0, -2.5, -5;
3267 contacts[0].penetration_depth = 5;
3268 contacts[0].normal << 0, -1, 0;
3275 contacts[0].penetration_depth = 5;
3282 contacts[0].pos << 0, -1.25, -5;
3283 contacts[0].penetration_depth = 7.5;
3284 contacts[0].normal << 0, -1, 0;
3291 contacts[0].penetration_depth = 7.5;
3298 contacts[0].pos << 0, -3.75, -5;
3299 contacts[0].penetration_depth = 2.5;
3300 contacts[0].normal << 0, -1, 0;
3307 contacts[0].penetration_depth = 2.5;
3314 contacts[0].pos << 0, 0.05, -5;
3315 contacts[0].penetration_depth = 10.1;
3316 contacts[0].normal << 0, -1, 0;
3323 contacts[0].penetration_depth = 10.1;
3343 contacts[0].pos << 0, 0, -2.5;
3344 contacts[0].penetration_depth = 5;
3345 contacts[0].normal << 0, 0, -1;
3352 contacts[0].penetration_depth = 5;
3359 contacts[0].pos << 0, 0, -1.25;
3360 contacts[0].penetration_depth = 7.5;
3361 contacts[0].normal << 0, 0, -1;
3368 contacts[0].penetration_depth = 7.5;
3375 contacts[0].pos << 0, 0, -3.75;
3376 contacts[0].penetration_depth= 2.5;
3377 contacts[0].normal << 0, 0, -1;
3384 contacts[0].penetration_depth = 2.5;
3391 contacts[0].pos << 0, 0, 0.05;
3392 contacts[0].penetration_depth = 10.1;
3393 contacts[0].normal << 0, 0, -1;
3400 contacts[0].penetration_depth = 10.1;
3413 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersection_halfspacecone)
3416 test_shapeIntersection_halfspacecone<double>();
3419 template <
typename S>
3431 std::vector<ContactPoint<S>> contacts;
3436 contacts[0].pos << 0, 0, 0;
3437 contacts[0].penetration_depth = 5;
3438 contacts[0].normal << 1, 0, 0;
3439 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3445 contacts[0].penetration_depth = 5;
3447 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3452 contacts[0].pos << 2.5, 0, -2.5;
3453 contacts[0].penetration_depth = 2.5;
3454 contacts[0].normal << 1, 0, 0;
3461 contacts[0].penetration_depth = 2.5;
3468 contacts[0].pos << -2.5, 0, -2.5;
3469 contacts[0].penetration_depth = 2.5;
3470 contacts[0].normal << -1, 0, 0;
3477 contacts[0].penetration_depth = 2.5;
3505 contacts[0].pos << 0, 0, 0;
3506 contacts[0].penetration_depth = 5;
3507 contacts[0].normal << 0, 1, 0;
3508 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3514 contacts[0].penetration_depth = 5;
3516 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3521 contacts[0].pos << 0, 2.5, -2.5;
3522 contacts[0].penetration_depth = 2.5;
3523 contacts[0].normal << 0, 1, 0;
3530 contacts[0].penetration_depth = 2.5;
3537 contacts[0].pos << 0, -2.5, -2.5;
3538 contacts[0].penetration_depth = 2.5;
3539 contacts[0].normal << 0, -1, 0;
3546 contacts[0].penetration_depth = 2.5;
3574 contacts[0].pos << 0, 0, 0;
3575 contacts[0].penetration_depth = 5;
3576 contacts[0].normal << 0, 0, 1;
3577 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3583 contacts[0].penetration_depth = 5;
3585 testShapeIntersection(s, tf1, hs, tf2,
GST_LIBCCD,
true, contacts,
true,
true,
true,
true);
3590 contacts[0].pos << 0, 0, 2.5;
3591 contacts[0].penetration_depth = 2.5;
3592 contacts[0].normal << 0, 0, 1;
3599 contacts[0].penetration_depth = 2.5;
3606 contacts[0].pos << 0, 0, -2.5;
3607 contacts[0].penetration_depth = 2.5;
3608 contacts[0].normal << 0, 0, -1;
3615 contacts[0].penetration_depth = 2.5;
3639 test_shapeIntersection_planecone<double>();
3666 template <
typename S>
3732 test_shapeDistance_spheresphere<double>();
3735 template <
typename S>
3805 test_shapeDistance_boxbox<double>();
3808 template <
typename S>
3848 test_shapeDistance_boxsphere<double>();
3851 template <
typename S>
3891 test_shapeDistance_cylindercylinder<double>();
3894 template <
typename S>
3934 test_shapeDistance_conecone<double>();
3937 template <
typename S>
3977 test_shapeDistance_conecylinder<double>();
3980 template <
typename S>
4043 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeDistance_ellipsoidellipsoid)
4046 test_shapeDistance_ellipsoidellipsoid<double>();
4073 template <
typename S>
4085 std::vector<ContactPoint<S>> contacts;
4098 contacts[0].normal << 1, 0, 0;
4099 contacts[0].pos << 20, 0, 0;
4100 contacts[0].penetration_depth = 0.0;
4114 contacts[0].normal << 1, 0, 0;
4115 contacts[0].pos << 20.0 - 0.1 * 20.0/(20.0 + 10.0), 0, 0;
4116 contacts[0].penetration_depth = 0.1;
4124 contacts[0].penetration_depth = 0.1;
4130 contacts[0].normal.setZero();
4131 contacts[0].pos.setZero();
4132 contacts[0].penetration_depth = 20.0 + 10.0;
4138 contacts[0].normal.setZero();
4140 contacts[0].penetration_depth = 20.0 + 10.0;
4146 contacts[0].normal << -1, 0, 0;
4147 contacts[0].pos << -20.0 + 0.1 * 20.0/(20.0 + 10.0), 0, 0;
4148 contacts[0].penetration_depth = 0.1;
4156 contacts[0].penetration_depth = 0.1;
4162 contacts[0].normal << -1, 0, 0;
4163 contacts[0].pos << -20, 0, 0;
4164 contacts[0].penetration_depth = 0.0;
4176 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_spheresphere)
4179 test_shapeIntersectionGJK_spheresphere<double>();
4182 template <
typename S>
4194 std::vector<ContactPoint<S>> contacts;
4202 contacts[0].normal << 1, 0, 0;
4203 contacts[1].normal << 1, 0, 0;
4204 contacts[2].normal << 1, 0, 0;
4205 contacts[3].normal << 1, 0, 0;
4253 test_shapeIntersectionGJK_boxbox<double>();
4256 template <
typename S>
4268 std::vector<ContactPoint<S>> contacts;
4285 contacts[0].normal << 1, 0, 0;
4319 contacts[0].normal << 1, 0, 0;
4320 testShapeIntersection(s1, tf1, s2, tf2,
GST_INDEP,
true, contacts,
false,
false,
true,
false, 1e-2);
4333 test_shapeIntersectionGJK_spherebox<double>();
4336 template <
typename S>
4348 std::vector<ContactPoint<S>> contacts;
4365 contacts[0].normal << 1, 0, 0;
4377 contacts[0].normal << 1, 0, 0;
4385 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_spherecapsule)
4388 test_shapeIntersectionGJK_spherecapsule<double>();
4391 template <
typename S>
4403 std::vector<ContactPoint<S>> contacts;
4420 contacts[0].normal << 1, 0, 0;
4421 testShapeIntersection(s1, tf1, s2, tf2,
GST_INDEP,
true, contacts,
false,
false,
true,
false, 3e-1);
4433 contacts[0].normal << 1, 0, 0;
4441 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_cylindercylinder)
4444 test_shapeIntersectionGJK_cylindercylinder<double>();
4447 template <
typename S>
4459 std::vector<ContactPoint<S>> contacts;
4476 contacts[0].normal << 1, 0, 0;
4477 testShapeIntersection(s1, tf1, s2, tf2,
GST_INDEP,
true, contacts,
false,
false,
true,
false, 5.7e-1);
4497 contacts[0].normal << 0, 0, 1;
4511 test_shapeIntersectionGJK_conecone<double>();
4514 template <
typename S>
4526 std::vector<ContactPoint<S>> contacts;
4562 contacts[0].normal << 0, 0, 1;
4575 contacts[0].normal << 0, 0, 1;
4583 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_cylindercone)
4586 test_shapeIntersectionGJK_cylindercone<double>();
4589 template <
typename S>
4602 std::vector<ContactPoint<S>> contacts;
4661 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_ellipsoidellipsoid)
4664 test_shapeIntersectionGJK_ellipsoidellipsoid<double>();
4667 template <
typename S>
4684 res = solver2<S>().shapeTriangleIntersect(s,
Transform3<S>::Identity(), t[0], t[1], t[2],
nullptr,
nullptr,
nullptr);
4687 res = solver2<S>().shapeTriangleIntersect(s,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
4691 t[1] << 9.9, -20, 0;
4693 res = solver2<S>().shapeTriangleIntersect(s,
Transform3<S>::Identity(), t[0], t[1], t[2],
nullptr,
nullptr,
nullptr);
4696 res = solver2<S>().shapeTriangleIntersect(s,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
4699 res = solver2<S>().shapeTriangleIntersect(s,
Transform3<S>::Identity(), t[0], t[1], t[2],
nullptr,
nullptr, &normal);
4703 res = solver2<S>().shapeTriangleIntersect(s,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr, &normal);
4708 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_spheretriangle)
4711 test_shapeIntersectionGJK_spheretriangle<double>();
4714 template <
typename S>
4734 res = solver2<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
4739 t[1] << -0.1, -20, 0;
4740 t[2] << -0.1, 20, 0;
4744 res = solver2<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
4751 res = solver2<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr, &normal);
4756 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_halfspacetriangle)
4759 test_shapeIntersectionGJK_halfspacetriangle<double>();
4762 template <
typename S>
4782 res = solver1<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
4787 t[1] << -0.1, -20, 0;
4788 t[2] << -0.1, 20, 0;
4792 res = solver2<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr,
nullptr);
4799 res = solver2<S>().shapeTriangleIntersect(hs,
transform, t[0], t[1], t[2],
transform,
nullptr,
nullptr, &normal);
4804 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeIntersectionGJK_planetriangle)
4807 test_shapeIntersectionGJK_planetriangle<double>();
4834 template <
typename S>
4899 test_shapeDistanceGJK_spheresphere<double>();
4902 template <
typename S>
4942 test_shapeDistanceGJK_boxbox<double>();
4945 template <
typename S>
4985 test_shapeDistanceGJK_boxsphere<double>();
4988 template <
typename S>
5025 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeDistanceGJK_cylindercylinder)
5028 test_shapeDistanceGJK_cylindercylinder<double>();
5031 template <
typename S>
5071 test_shapeDistanceGJK_conecone<double>();
5074 template <
typename S>
5135 GTEST_TEST(FCL_GEOMETRIC_SHAPES, shapeDistanceGJK_ellipsoidellipsoid)
5138 test_shapeDistanceGJK_ellipsoidellipsoid<double>();
5141 template<
typename Shape1,
typename Shape2>
5144 using S =
typename Shape2::S;
5149 std::vector<ContactPoint<S>> contactsA;
5150 std::vector<ContactPoint<S>> contactsB;
5155 const double tol = 1e-6;
5157 resA = solver1<S>().shapeIntersect(s1, tf1, s2, tf2, &contactsA);
5158 resB = solver1<S>().shapeIntersect(s2, tf2, s1, tf1, &contactsB);
5161 for (
size_t i = 0; i < contactsB.size(); ++i)
5162 contactsB[i].normal = -contactsB[i].normal;
5167 contactsA, contactsB,
5168 true,
true,
true,
false, tol));
5170 resA = solver2<S>().shapeIntersect(s1, tf1, s2, tf2, &contactsA);
5171 resB = solver2<S>().shapeIntersect(s2, tf2, s1, tf1, &contactsB);
5174 for (
size_t i = 0; i < contactsB.size(); ++i)
5175 contactsB[i].normal = -contactsB[i].normal;
5180 contactsA, contactsB,
5181 true,
true,
true,
false, tol));
5184 template <
typename S>
5244 GTEST_TEST(FCL_GEOMETRIC_SHAPES, reversibleShapeIntersection_allshapes)
5247 test_reversibleShapeIntersection_allshapes<double>();
5250 template<
typename Shape1,
typename Shape2>
5253 using S =
typename Shape2::S;
5268 const double tol = 1e-6;
5270 resA = solver1<S>().shapeDistance(s1, tf1, s2, tf2, &distA, &p1A, &p2A);
5271 resB = solver1<S>().shapeDistance(s2, tf2, s1, tf1, &distB, &p1B, &p2B);
5279 resA = solver2<S>().shapeDistance(s1, tf1, s2, tf2, &distA, &p1A, &p2A);
5280 resB = solver2<S>().shapeDistance(s2, tf2, s1, tf1, &distB, &p1B, &p2B);
5289 template <
typename S>
5349 GTEST_TEST(FCL_GEOMETRIC_SHAPES, reversibleShapeDistance_allshapes)
5352 test_reversibleShapeDistance_allshapes<double>();
5358 ::testing::InitGoogleTest(&argc, argv);
5359 return RUN_ALL_TESTS();