38 #include <gtest/gtest.h> 
   43 #include "fcl_resources/config.h" 
   65                       const std::vector<
Vector3<S>>& vertices1, 
const std::vector<Triangle>& triangles1,
 
   68 template<
typename BV, 
typename TraversalNode>
 
   79   if(fabs(a[0] - b[0]) > DELTA<S>()) 
return false;
 
   80   if(fabs(a[1] - b[1]) > DELTA<S>()) 
return false;
 
   81   if(fabs(a[2] - b[2]) > DELTA<S>()) 
return false;
 
   88   std::vector<Vector3<S>> p1, p2;
 
   89   std::vector<Triangle> t1, t2;
 
   95   S 
extents[] = {-3000, -3000, 0, 3000, 3000, 3000};
 
  108   for(std::size_t i = 0; i < transforms.size(); ++i)
 
  124     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  129     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  134     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  139     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  144     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  149     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  154     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  159     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  164     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  169     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  174     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  179     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  184     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  189     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  194     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  199     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  204     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  211     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  216     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  221     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  226     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  231     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  236     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  241     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  246     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  251     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  256     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  261     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  266     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  272     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  277     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  282     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  287     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  292     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  297     EXPECT_TRUE(fabs(res.distance - res_now.distance) < DELTA<S>());
 
  302   std::cout << 
"distance timing: " << dis_time << 
" sec" << std::endl;
 
  303   std::cout << 
"collision timing: " << col_time << 
" sec" << std::endl;
 
  309   test_mesh_distance<double>();
 
  312 template <
typename S>
 
  326   std::shared_ptr<CollisionGeometry<S>> box_geometry_1(
 
  327       new Box<S>(2.750000, 6.000000, 0.050000));
 
  328   std::shared_ptr<CollisionGeometry<S>> box_geometry_2(
 
  329       new Box<S>(0.424000, 0.150000, 0.168600));
 
  343   Box<S>* box1 = 
static_cast<Box<S>*
>(box_geometry_1.get());
 
  344   Box<S>* box2 = 
static_cast<Box<S>*
>(box_geometry_2.get());
 
  363   S expected_dist{0.053516162824549};
 
  366   const Vector3<S> expected_p_B1N1{-1.375, -0.098881502700918666,
 
  367                                    -0.025000000000000022};
 
  368   const Vector3<S> expected_p_B2N2{0.21199965773384655, 0.074999692703297122,
 
  369                                    0.084299993303443954};
 
  384   NearestPointFromDegenerateSimplex<double>();
 
  387 template<
typename BV, 
typename TraversalNode>
 
  395   using S = 
typename BV::S;
 
  414     std::cout << 
"initialize error" << std::endl;
 
  416   node.enable_statistics = 
verbose;
 
  426   distance_result.
p1 = p1;
 
  427   distance_result.
p2 = p2;
 
  431     std::cout << 
"distance " << local_result.
min_distance << std::endl;
 
  433     std::cout << p1[0] << 
" " << p1[1] << 
" " << p1[2] << std::endl;
 
  434     std::cout << p2[0] << 
" " << p2[1] << 
" " << p2[2] << std::endl;
 
  435     std::cout << node.num_bv_tests << 
" " << node.num_leaf_tests << std::endl;
 
  439 template<
typename BV>
 
  447   using S = 
typename BV::S;
 
  469   if(!detail::initialize<BV>(node, m1, pose1, m2, pose2, 
DistanceRequest<S>(
true), local_result))
 
  470     std::cout << 
"initialize error" << std::endl;
 
  482     std::cout << 
"distance " << local_result.
min_distance << std::endl;
 
  490 template <
typename S>
 
  492                       const std::vector<
Vector3<S>>& vertices1, 
const std::vector<Triangle>& triangles1,
 
  512     std::cout << 
"initialize error" << std::endl;
 
  525 int main(
int argc, 
char* argv[])
 
  527   ::testing::InitGoogleTest(&argc, argv);
 
  528   return RUN_ALL_TESTS();