17 #include <boost/filesystem.hpp>
21 #include "../src/collision_node.h"
25 #include "fcl_resources/config.h"
27 #define RUN_CASE(BV, tf, models, split) \
28 run<BV>(tf, models, split, #BV " - " #split ":\t")
35 template <
typename BV>
36 void makeModel(
const std::vector<Vec3f>& vertices,
37 const std::vector<Triangle>& triangles,
40 template <
typename BV,
typename TraversalNode>
44 template <
typename BV,
typename TraversalNode>
48 template <
typename BV>
49 double run(
const std::vector<Transform3f>& tf,
53 template <
typename BV>
80 template <
typename BV>
82 const std::vector<Triangle>& triangles,
92 template <
typename BV,
typename TraversalNode>
101 node.enable_statistics =
verbose;
106 for (std::size_t i = 0; i < tf.size(); ++i) {
107 if (!
initialize(node, m1, tf[i], m2, pose2, request, local_result))
108 std::cout <<
"initialize error" << std::endl;
116 template <
typename BV,
typename TraversalNode>
123 TraversalNode node(request);
125 node.enable_statistics =
verbose;
130 for (std::size_t i = 0; i < tf.size(); ++i) {
131 bool success(
initialize(node, m1, tf[i], m2, pose2, local_result));
136 collide(&node, request, result);
143 template <
typename BV>
144 double run(
const std::vector<Transform3f>& tf,
146 const char* prefix) {
147 double col = collide<BV, typename traits<BV>::CollisionTraversalNode>(
148 tf, models[0][split_method], models[1][split_method],
verbose);
149 double dist = distance<BV, typename traits<BV>::DistanceTraversalNode>(
150 tf, models[0][split_method], models[1][split_method],
verbose);
152 std::cout << prefix <<
" (" << col <<
", " << dist <<
")\n";
157 double run<OBB>(
const std::vector<Transform3f>& tf,
159 const char* prefix) {
160 double col = collide<OBB, traits<OBB>::CollisionTraversalNode>(
161 tf, models[0][split_method], models[1][split_method],
verbose);
164 std::cout << prefix <<
" (\t" << col <<
", \tNaN)\n";
169 std::vector<Vec3f>
p1, p2;
170 std::vector<Triangle> t1, t2;
210 std::vector<Transform3f> transforms;
212 std::size_t n = 10000;
215 double total_time = 0;
233 std::cout <<
"\n\nTotal time: " << total_time << std::endl;