39 #define BOOST_TEST_MODULE COAL_GEOMETRIC_SHAPES 
   40 #include <boost/test/included/unit_test.hpp> 
   60 #define SET_LINE line = __LINE__ 
   61 #define FCL_CHECK(cond) \ 
   62   BOOST_CHECK_MESSAGE(cond, "from line " << line << ": " #cond) 
   63 #define FCL_CHECK_EQUAL(a, b)                                                \ 
   64   BOOST_CHECK_MESSAGE((a) == (b), "from line " << line << ": " #a "[" << (a) \ 
   65                                                << "] != " #b "[" << (b)      \ 
   67 #define BOOST_CHECK_FALSE(p) BOOST_CHECK(!(p)) 
   71   return os << 
"a_shape";
 
   75   return os << 
"Box(" << 2 * 
b.halfSide.transpose() << 
')';
 
   79 template <
typename S1, 
typename S2>
 
   83                           const Vec3s& contact_or_normal,
 
   84                           const Vec3s& expected_contact_or_normal,
 
   86   std::cout << 
"Disagreement between " << comparison_type << 
" and expected_" 
   89             << 
"tf1.quaternion: " << 
tf1.getQuatRotation() << std::endl
 
   90             << 
"tf1.translation: " << 
tf1.getTranslation().transpose()
 
   92             << 
"tf2.quaternion: " << 
tf2.getQuatRotation() << std::endl
 
   93             << 
"tf2.translation: " << 
tf2.getTranslation().transpose()
 
   95             << comparison_type << 
": " << contact_or_normal.transpose()
 
   97             << 
"expected_" << comparison_type << 
": " 
   98             << expected_contact_or_normal.transpose();
 
  100   if (check_opposite_normal)
 
  101     std::cout << 
" or " << -expected_contact_or_normal.transpose();
 
  103   std::cout << std::endl
 
  105             << (contact_or_normal - expected_contact_or_normal).norm()
 
  107             << 
"tolerance: " << tol << std::endl;
 
  110 template <
typename S1, 
typename S2>
 
  115   std::cout << 
"Disagreement between " << comparison_type << 
" and expected_" 
  118             << 
"tf1.quaternion: " << 
tf1.getQuatRotation() << std::endl
 
  119             << 
"tf1.translation: " << 
tf1.getTranslation() << std::endl
 
  120             << 
"tf2.quaternion: " << 
tf2.getQuatRotation() << std::endl
 
  121             << 
"tf2.translation: " << 
tf2.getTranslation() << std::endl
 
  122             << 
"depth: " << depth << std::endl
 
  123             << 
"expected_depth: " << expected_depth << std::endl
 
  124             << 
"difference: " << std::fabs(depth - expected_depth) << std::endl
 
  125             << 
"tolerance: " << tol << std::endl;
 
  128 template <
typename S1, 
typename S2>
 
  133                     Vec3s* expected_normal, 
bool check_opposite_normal,
 
  135   if (expected_point) {
 
  136     bool contact_equal = 
isEqual(contact, *expected_point, tol);
 
  140                            *expected_point, 
false, tol);
 
  143   if (expected_depth) {
 
  144     bool depth_equal = std::fabs(depth - *expected_depth) < tol;
 
  151   if (expected_normal) {
 
  152     bool normal_equal = 
isEqual(normal, *expected_normal, tol);
 
  154     if (!normal_equal && check_opposite_normal)
 
  155       normal_equal = 
isEqual(normal, -(*expected_normal), tol);
 
  160                            check_opposite_normal, tol);
 
  164 template <
typename S1, 
typename S2>
 
  167                       Vec3s* expected_point = NULL,
 
  169                       Vec3s* expected_normal = NULL,
 
  170                       bool check_opposite_normal = 
false,
 
  178   bool check_failed = 
false;
 
  184   check_failed = check_failed || (
collision != expect_collision);
 
  190   check_failed = check_failed || (
collision != expect_collision);
 
  193     BOOST_TEST_MESSAGE(
"Failure occured between " << s1 << 
" and " << s2
 
  194                                                   << 
" at transformations\n" 
  199   if (expect_collision) {
 
  205                      expected_normal, check_opposite_normal, tol);
 
  335   return c1[2] < 
c2[2];
 
  339   Box s1(100, 100, 100);
 
  343   std::vector<Vec3s> vertices(8);
 
  344   vertices[0] << 1, 1, 1;
 
  345   vertices[1] << 1, 1, -1;
 
  346   vertices[2] << 1, -1, 1;
 
  347   vertices[3] << 1, -1, -1;
 
  348   vertices[4] << -1, 1, 1;
 
  349   vertices[5] << -1, 1, -1;
 
  350   vertices[6] << -1, -1, 1;
 
  351   vertices[7] << -1, -1, -1;
 
  353   for (std::size_t i = 0; i < 8; ++i) {
 
  354     vertices[i].array() *= s2.
halfSide.array();
 
  366   const bool compute_penetration = 
true;
 
  368       s1, 
tf1, s2, 
tf2, compute_penetration, 
p1, p2, normal);
 
  372   for (std::size_t i = 0; i < 8; ++i) vertices[i] = 
tf2.transform(vertices[i]);
 
  381   FCL_CHECK(vertices[0][2] <= point[2] && point[2] < 0);
 
  446   for (
int i = 0; i < numTests; ++i) {
 
  508   rotSphere << 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0;
 
  512   rotBox << 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0;
 
  695   normal = 
transform.getRotation() * normal;
 
  703   normal = 
transform.getRotation() * normal;
 
  773   normal = 
transform.getRotation() * normal;
 
  785   normal = 
transform.getRotation() * normal;
 
  866     normal = 
transform.getRotation() * normal;
 
  871     tf_tri.setTranslation(
Vec3s(0, 0, -0.001));
 
  875     normal = 
transform.getRotation() * normal;
 
  890     normal << 9.9, 0, 0.001;
 
  894     normal = 
transform.getRotation() * normal;
 
  899     tf_tri.setTranslation(
Vec3s(0, 0, -0.001));
 
  900     normal << 9.9, 0, -0.001;
 
  904     normal = 
transform.getRotation() * normal;
 
  922     normal = 
transform.getRotation() * normal;
 
  927     tf_tri.setTranslation(
Vec3s(0, -0.001, 0));
 
  931     normal = 
transform.getRotation() * normal;
 
  949     normal = 
transform.getRotation() * normal;
 
  954     tf_tri.setTranslation(
Vec3s(-0.001, 0, 0));
 
  958     normal = 
transform.getRotation() * normal;
 
  981     tf_tri.setTranslation(
Vec3s(0, 0, -10.1));
 
 1002     tf_tri.setTranslation(
Vec3s(0, -10.1, 0));
 
 1023     tf_tri.setTranslation(
Vec3s(-10.1, 0, 0));
 
 1053     normal = 
transform.getRotation() * normal;
 
 1058     tf_tri.setTranslation(
Vec3s(0, 0, 0.001));
 
 1064     tf_tri.setTranslation(
Vec3s(1, 1, 0.001));
 
 1070     tf_tri.setTranslation(
Vec3s(-1, -1, 0.001));
 
 1089     normal = 
transform.getRotation() * normal;
 
 1094     tf_tri.setTranslation(
Vec3s(0, 0, 0.001));
 
 1100     tf_tri.setTranslation(
Vec3s(1, 1, 0.001));
 
 1106     tf_tri.setTranslation(
Vec3s(-1, -1, 0.001));
 
 1125     normal = 
transform.getRotation() * normal;
 
 1130     tf_tri.setTranslation(
Vec3s(0, 0, 0.001));
 
 1136     tf_tri.setTranslation(
Vec3s(1, 1, 0.001));
 
 1142     tf_tri.setTranslation(
Vec3s(-1, -1, 0.001));
 
 1158     t[0] << 20, 0, 0.05;
 
 1159     t[1] << -20, 0, 0.05;
 
 1160     t[2] << 0, 20, -0.1;
 
 1168     normal = 
transform.getRotation() * normal;
 
 1173     tf_tri.setTranslation(
Vec3s(0, 0, 0.05));
 
 1177     normal = 
transform.getRotation() * normal;
 
 1182     tf_tri.setTranslation(
Vec3s(0, 0, -0.06));
 
 1188     tf_tri.setTranslation(
Vec3s(0, 0, 0.11));
 
 1197     t[0] << 30, 0.05, 0;
 
 1198     t[1] << -20, 0.05, 0;
 
 1199     t[2] << 0, -0.1, 20;
 
 1207     normal = 
transform.getRotation() * normal;
 
 1212     tf_tri.setTranslation(
Vec3s(0, 0.05, 0));
 
 1216     normal = 
transform.getRotation() * normal;
 
 1221     tf_tri.setTranslation(
Vec3s(0, -0.06, 0));
 
 1227     tf_tri.setTranslation(
Vec3s(0, 0.11, 0));
 
 1236     t[0] << 0.05, 30, 0;
 
 1237     t[1] << 0.05, -10, 0;
 
 1238     t[2] << -0.1, 0, 20;
 
 1246     normal = 
transform.getRotation() * normal;
 
 1251     tf_tri.setTranslation(
Vec3s(0.05, 0, 0));
 
 1255     normal = 
transform.getRotation() * normal;
 
 1260     tf_tri.setTranslation(
Vec3s(-0.06, 0, 0));
 
 1266     tf_tri.setTranslation(
Vec3s(0.11, 0, 0));
 
 1290   contact << -5, 0, 0;
 
 1306   contact << -2.5, 0, 0;
 
 1322   contact << -7.5, 0, 0;
 
 1348   contact << 0.05, 0, 0;
 
 1382   p1 << -10 + 
eps, 0, 0;
 
 1384   contact << (
p1 + p2) / 2;
 
 1401   p1 << 10 + 
eps, 0, 0;
 
 1403   contact << (
p1 + p2) / 2;
 
 1419   contact << (
p1 + p2) / 2;
 
 1437   contact << (
p1 + p2) / 2;
 
 1488   contact << -1.25, 0, 0;
 
 1504   contact << -0.625, 0, 0;
 
 1520   contact << -1.875, 0, 0;
 
 1536   contact << 0.005, 0, 0;
 
 1584   contact << (
p1 + p2) / 2;
 
 1601   contact << (
p1 + p2) / 2;
 
 1619   contact << (
p1 + p2) / 2;
 
 1675   contact << -2.5, 0, 0;
 
 1691   contact << -1.25, 0, 0;
 
 1707   contact << -3.75, 0, 0;
 
 1723   contact << 0.05, 0, 0;
 
 1751   contact << 0, -2.5, 0;
 
 1767   contact << 0, -1.25, 0;
 
 1783   contact << 0, -3.75, 0;
 
 1799   contact << 0, 0.05, 0;
 
 1827   contact << 0, 0, -5;
 
 1843   contact << 0, 0, -3.75;
 
 1859   contact << 0, 0, -6.25;
 
 1875   contact << 0, 0, 0.05;
 
 1932   contact << 2.5, 0, 0;
 
 1948   contact << -2.5, 0, 0;
 
 2002   contact << 0, 2.5, 0;
 
 2018   contact << 0, -2.5, 0;
 
 2072   contact << 0, 0, 2.5;
 
 2088   contact << 0, 0, -2.5;
 
 2139   contact << -2.5, 0, 0;
 
 2155   contact << -1.25, 0, 0;
 
 2171   contact << -3.75, 0, 0;
 
 2187   contact << 0.05, 0, 0;
 
 2215   contact << 0, -2.5, 0;
 
 2231   contact << 0, -1.25, 0;
 
 2247   contact << 0, -3.75, 0;
 
 2263   contact << 0, 0.05, 0;
 
 2291   contact << 0, 0, -2.5;
 
 2307   contact << 0, 0, -1.25;
 
 2323   contact << 0, 0, -3.75;
 
 2339   contact << 0, 0, 0.05;
 
 2382   p1 << -5 + 
eps, 0, 0;
 
 2384   contact << (
p1 + p2) / 2;
 
 2402   p1 << 5 + 
eps, 0, 0;
 
 2404   contact << (
p1 + p2) / 2;
 
 2423   contact << (
p1 + p2) / 2;
 
 2441   contact << (
p1 + p2) / 2;
 
 2480   p1 << 0, -5 + 
eps, 0;
 
 2482   contact << (
p1 + p2) / 2;
 
 2499   p1 << 0, 5 + 
eps, 0;
 
 2501   contact << (
p1 + p2) / 2;
 
 2519   contact << (
p1 + p2) / 2;
 
 2537   contact << (
p1 + p2) / 2;
 
 2576   p1 << 0, 0, -5 + 
eps;
 
 2578   contact << (
p1 + p2) / 2;
 
 2595   p1 << 0, 0, 5 + 
eps;
 
 2597   contact << (
p1 + p2) / 2;
 
 2615   contact << (
p1 + p2) / 2;
 
 2633   contact << (
p1 + p2) / 2;
 
 2684   contact << -2.5, 0, -5;
 
 2700   contact << -1.25, 0, -5;
 
 2716   contact << -3.75, 0, -5;
 
 2732   contact << 0.05, 0, -5;
 
 2760   contact << 0, -2.5, -5;
 
 2776   contact << 0, -1.25, -5;
 
 2792   contact << 0, -3.75, -5;
 
 2808   contact << 0, 0.05, -5;
 
 2836   contact << 0, 0, -2.5;
 
 2852   contact << 0, 0, -1.25;
 
 2868   contact << 0, 0, -3.75;
 
 2884   contact << 0, 0, 0.05;
 
 2927   p1 << -5 + 
eps, 0, -5;
 
 2929   contact << (
p1 + p2) / 2;
 
 2947   p1 << 5 + 
eps, 0, -5;
 
 2949   contact << (
p1 + p2) / 2;
 
 2968   contact << (
p1 + p2) / 2;
 
 2986   contact << (
p1 + p2) / 2;
 
 3025   p1 << 0, -5 + 
eps, -5;
 
 3027   contact << (
p1 + p2) / 2;
 
 3044   p1 << 0, 5 + 
eps, -5;
 
 3046   contact << (
p1 + p2) / 2;
 
 3064   contact << (
p1 + p2) / 2;
 
 3082   contact << (
p1 + p2) / 2;
 
 3121   p1 << 0, 0, -5 + 
eps;
 
 3123   contact << (
p1 + p2) / 2;
 
 3140   p1 << 0, 0, 5 + 
eps;
 
 3142   contact << (
p1 + p2) / 2;
 
 3160   contact << (
p1 + p2) / 2;
 
 3178   contact << (
p1 + p2) / 2;
 
 3225     Vec3s n = Vec3s::Random().normalized();
 
 3227     Plane plane1(n, offset);
 
 3228     Plane plane2(n, offset);
 
 3233     contact = plane1.
n * plane1.
d;
 
 3241     normal = 
transform.getRotation() * normal;
 
 3252     Vec3s n = Vec3s::Random().normalized();
 
 3255     Plane plane1(n, offset1);
 
 3256     Plane plane2(n, offset2);
 
 3270     Vec3s n = Vec3s::Random().normalized();
 
 3273     Plane plane1(n, offset1);
 
 3274     Plane plane2(n, offset2);
 
 3293     Plane plane2(n2, offset2);
 
 3298     contact << offset1, 0, offset2;
 
 3304     normal = 
transform.getRotation() * normal;
 
 3315     Plane plane2(n2, offset2);
 
 3319     normal << 0, -0.5774, 0.5774;
 
 3326     normal = 
transform.getRotation() * normal;
 
 3345     Vec3s n = Vec3s::Random().normalized();
 
 3358     normal = 
transform.getRotation() * normal;
 
 3364     Vec3s n = Vec3s::Random().normalized();
 
 3378     normal = 
transform.getRotation() * normal;
 
 3384     Vec3s n = Vec3s::Random().normalized();
 
 3399     normal = 
transform.getRotation() * normal;
 
 3420     normal = 
transform.getRotation() * normal;
 
 3435     normal << 0, -0.5774, 0.5774;
 
 3442     normal = 
transform.getRotation() * normal;
 
 3461     Vec3s n = Vec3s::Random().normalized();
 
 3464     Plane plane(n, offset);
 
 3475     normal = 
transform.getRotation() * normal;
 
 3481     Vec3s n = Vec3s::Random().normalized();
 
 3485     Plane plane(n, offset2);
 
 3496     normal = 
transform.getRotation() * normal;
 
 3502     Vec3s n = Vec3s::Random().normalized();
 
 3506     Plane plane(n, offset2);
 
 3517     normal = 
transform.getRotation() * normal;
 
 3528     Plane plane(n2, offset2);
 
 3538     normal = 
transform.getRotation() * normal;
 
 3549     Plane plane(n2, offset2);
 
 3553     normal << 0, -0.5774, 0.5774;
 
 3560     normal = 
transform.getRotation() * normal;
 
 3570   Vec3s closest_p1, closest_p2, normal;
 
 3571   bool compute_penetration = 
true;
 
 3580       closest_p1, closest_p2, normal);
 
 3581   BOOST_CHECK(fabs(dist - 10) < 0.001);
 
 3585       compute_penetration, closest_p1, closest_p2, normal);
 
 3586   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3590       compute_penetration, closest_p1, closest_p2, normal);
 
 3591   BOOST_CHECK(dist <= 0);
 
 3595                                closest_p2, normal);
 
 3596   BOOST_CHECK(fabs(dist - 10) < 0.001);
 
 3600                                closest_p2, normal);
 
 3601   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3605                                closest_p2, normal);
 
 3606   BOOST_CHECK(dist < 0);
 
 3610       compute_penetration, closest_p1, closest_p2, normal);
 
 3611   BOOST_CHECK(fabs(dist - 10) < 0.001);
 
 3615       compute_penetration, closest_p1, closest_p2, normal);
 
 3616   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3620       compute_penetration, closest_p1, closest_p2, normal);
 
 3621   BOOST_CHECK(dist < 0);
 
 3624                                transform, compute_penetration, closest_p1,
 
 3625                                closest_p2, normal);
 
 3626   BOOST_CHECK(fabs(dist - 10) < 0.001);
 
 3629                                s2, 
transform, compute_penetration, closest_p1,
 
 3630                                closest_p2, normal);
 
 3631   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3634                                s2, 
transform, compute_penetration, closest_p1,
 
 3635                                closest_p2, normal);
 
 3636   BOOST_CHECK(dist < 0);
 
 3642   Vec3s closest_p1, closest_p2, normal;
 
 3643   bool compute_penetration = 
true;
 
 3651                                compute_penetration, closest_p1, closest_p2,
 
 3653   BOOST_CHECK(dist <= 0);
 
 3657                             closest_p1, closest_p2, normal);
 
 3658   BOOST_CHECK(dist <= 0);
 
 3662       compute_penetration, closest_p1, closest_p2, normal);
 
 3663   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3667       compute_penetration, closest_p1, closest_p2, normal);
 
 3668   BOOST_CHECK(fabs(dist - 10.1) < 0.001);
 
 3672       compute_penetration, closest_p1, closest_p2, normal);
 
 3673   BOOST_CHECK(fabs(dist - 10.2) < 0.001);
 
 3677       compute_penetration, closest_p1, closest_p2, normal);
 
 3678   BOOST_CHECK(fabs(dist - 0.1 * 1.414) < 0.001);
 
 3682       compute_penetration, closest_p1, closest_p2, normal);
 
 3683   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3687       compute_penetration, closest_p1, closest_p2, normal);
 
 3688   BOOST_CHECK(fabs(dist - 10.1) < 0.001);
 
 3692       compute_penetration, closest_p1, closest_p2, normal);
 
 3693   BOOST_CHECK(fabs(dist - 10.1) < 0.001);
 
 3697       compute_penetration, closest_p1, closest_p2, normal);
 
 3698   BOOST_CHECK(fabs(dist - 0.1 * 1.414) < 0.001);
 
 3702       compute_penetration, closest_p1, closest_p2, normal);
 
 3703   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3707       closest_p1, closest_p2, normal);
 
 3708   BOOST_CHECK(fabs(dist - 5) < 0.001);
 
 3712       compute_penetration, closest_p1, closest_p2, normal);
 
 3713   BOOST_CHECK(fabs(dist - 5) < 0.001);
 
 3718   Box s2(1.6, 0.6, 0.025);
 
 3721       Quatf(0.5279170511703305, -0.50981118132505521, -0.67596178682051911,
 
 3722             0.0668715876735793),
 
 3723       Vec3s(0.041218354748013122, 1.2022554710435607, 0.77338855025700015));
 
 3726       Quatf(0.70738826916719977, 0, 0, 0.70682518110536596),
 
 3727       Vec3s(-0.29936284351096382, 0.80023864435868775, 0.71750000000000003));
 
 3731   bool compute_penetration = 
true;
 
 3735   Vec3s p2Loc(
tf1.inverse().transform(p2));
 
 3736   bool p2_in_cylinder((fabs(p2Loc[2]) <= s1.
halfLength) &&
 
 3737                       (p2Loc[0] * p2Loc[0] + p2Loc[1] * p2Loc[1] <= s1.
radius));
 
 3739   bool p1_in_box = (p1Loc.array().abs() <= s2.
halfSide.array()).all();
 
 3740   std::cout << 
"p2 in cylinder = (" << p2Loc.transpose() << 
")" << std::endl;
 
 3741   std::cout << 
"p1 in box = (" << p1Loc.transpose() << 
")" << std::endl;
 
 3743   BOOST_CHECK((!p2_in_cylinder && !p1_in_box) || (p2_in_cylinder && p1_in_box));
 
 3749   p2Loc = 
tf1.inverse().transform(p2);
 
 3750   p2_in_cylinder = (fabs(p2Loc[2]) <= s1.
halfLength) &&
 
 3751                    (p2Loc[0] * p2Loc[0] + p2Loc[1] * p2Loc[1] <= s1.
radius);
 
 3752   p1Loc = 
tf2.inverse().transform(
p1);
 
 3753   p1_in_box = (p1Loc.array().abs() <= s2.
halfSide.array()).all();
 
 3755   std::cout << 
"p2 in cylinder = (" << p2Loc.transpose() << 
")" << std::endl;
 
 3756   std::cout << 
"p1 in box = (" << 
p1.transpose() << 
")" << std::endl;
 
 3758   BOOST_CHECK((!p2_in_cylinder && !p1_in_box) || (p2_in_cylinder && p1_in_box));
 
 3762       Vec3s(-0.66734052046473924, 0.22219183277457269, 0.76825248755616293));
 
 3763   tf1.setQuatRotation(
Quatf(0.52613359459338371, 0.32189408354839893,
 
 3764                             0.70415587451837913, -0.35175580165512249));
 
 3771   Vec3s closest_p1, closest_p2, normal;
 
 3772   bool compute_penetration = 
true;
 
 3780   for (
int i = 0; i < N + 1; ++i) {
 
 3784                                  closest_p2, normal);
 
 3785     BOOST_CHECK_CLOSE(dist, (dbox - s1.
radius - s2.
halfSide(0)), 1e-6);
 
 3790                               closest_p1, closest_p2, normal);
 
 3793         compute_penetration, closest_p1, closest_p2, normal);
 
 3794     BOOST_CHECK_CLOSE(dist, (dbox - s1.
radius - s2.
halfSide(0)), 1e-6);
 
 3799                                compute_penetration, closest_p1, closest_p2,
 
 3801   BOOST_CHECK(dist <= 0);
 
 3805                             closest_p1, closest_p2, normal);
 
 3806   BOOST_CHECK(dist <= 0);
 
 3810       compute_penetration, closest_p1, closest_p2, normal);
 
 3811   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3815       compute_penetration, closest_p1, closest_p2, normal);
 
 3816   BOOST_CHECK(fabs(dist - 0.1) < 0.01);
 
 3820       closest_p1, closest_p2, normal);
 
 3821   BOOST_CHECK(fabs(dist - 17.5) < 0.001);
 
 3825       compute_penetration, closest_p1, closest_p2, normal);
 
 3826   BOOST_CHECK(fabs(dist - 17.5) < 0.001);
 
 3832   Vec3s closest_p1, closest_p2, normal;
 
 3833   bool compute_penetration = 
true;
 
 3845                                  compute_penetration, closest_p1, closest_p2,
 
 3847     BOOST_CHECK(dist <= 0);
 
 3851                               closest_p1, closest_p2, normal);
 
 3852     BOOST_CHECK(dist <= 0);
 
 3862                                  compute_penetration, closest_p1, closest_p2,
 
 3864     BOOST_CHECK(dist <= 0);
 
 3868                               closest_p1, closest_p2, normal);
 
 3869     BOOST_CHECK(dist <= 0);
 
 3878       compute_penetration, closest_p1, closest_p2, normal);
 
 3879   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3883       compute_penetration, closest_p1, closest_p2, normal);
 
 3884   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3888       closest_p1, closest_p2, normal);
 
 3889   BOOST_CHECK(fabs(dist - 30) < 0.001);
 
 3893       compute_penetration, closest_p1, closest_p2, normal);
 
 3894   BOOST_CHECK(fabs(dist - 30) < 0.001);
 
 3900   Vec3s closest_p1, closest_p2, normal;
 
 3901   bool compute_penetration = 
true;
 
 3913                                  compute_penetration, closest_p1, closest_p2,
 
 3915     BOOST_CHECK(dist <= 0);
 
 3919                               closest_p1, closest_p2, normal);
 
 3920     BOOST_CHECK(dist <= 0);
 
 3930                                  compute_penetration, closest_p1, closest_p2,
 
 3932     BOOST_CHECK(dist <= 0);
 
 3936                               closest_p1, closest_p2, normal);
 
 3937     BOOST_CHECK(dist <= 0);
 
 3946       compute_penetration, closest_p1, closest_p2, normal);
 
 3947   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3951       compute_penetration, closest_p1, closest_p2, normal);
 
 3952   BOOST_CHECK(fabs(dist - 0.1) < 0.001);
 
 3956       closest_p1, closest_p2, normal);
 
 3957   BOOST_CHECK(fabs(dist - 30) < 1);
 
 3961       compute_penetration, closest_p1, closest_p2, normal);
 
 3962   BOOST_CHECK(fabs(dist - 30) < 1);
 
 3968   Vec3s closest_p1, closest_p2, normal;
 
 3969   bool compute_penetration = 
true;
 
 3981                                  compute_penetration, closest_p1, closest_p2,
 
 3983     BOOST_CHECK(dist <= 0);
 
 3987                               closest_p1, closest_p2, normal);
 
 3988     BOOST_CHECK(dist <= 0);
 
 3998                                  compute_penetration, closest_p1, closest_p2,
 
 4000     BOOST_CHECK(dist <= 0);
 
 4004                               closest_p1, closest_p2, normal);
 
 4005     BOOST_CHECK(dist <= 0);
 
 4014       compute_penetration, closest_p1, closest_p2, normal);
 
 4015   BOOST_CHECK(fabs(dist - 0.1) < 0.01);
 
 4019       compute_penetration, closest_p1, closest_p2, normal);
 
 4020   BOOST_CHECK(fabs(dist - 0.1) < 0.02);
 
 4024       closest_p1, closest_p2, normal);
 
 4025   BOOST_CHECK(fabs(dist - 30) < 0.01);
 
 4029       compute_penetration, closest_p1, closest_p2, normal);
 
 4030   BOOST_CHECK(fabs(dist - 30) < 0.1);
 
 4033 template <
typename S1, 
typename S2>
 
 4045   Vec3s normalA, normalB;
 
 4046   bool compute_penetration = 
true;
 
 4048   const double tol = 1e-6;
 
 4055   assert((distA <= 0 && distB <= 0) || (distA > 0 && distB > 0));
 
 4056   BOOST_CHECK_CLOSE(distA, distB, tol);  
 
 4059   BOOST_CHECK(
isEqual(p2A, p1B, tol));
 
 4066   assert((distA <= 0 && distB <= 0) || (distA > 0 && distB > 0));
 
 4069   BOOST_CHECK_CLOSE(distA, distB, tol);
 
 4070   BOOST_CHECK(
isEqual(p1A, p2B, tol));
 
 4071   BOOST_CHECK(
isEqual(p2A, p1B, tol));