broadphase.cpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2015, Open Source Robotics Foundation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
38 #define BOOST_TEST_MODULE COAL_BROADPHASE
39 #include <boost/test/included/unit_test.hpp>
40 
41 #include "coal/config.hh"
44 #include "coal/math/transform.h"
45 #include "utility.h"
46 
47 #if USE_GOOGLEHASH
48 #include <sparsehash/sparse_hash_map>
49 #include <sparsehash/dense_hash_map>
50 #include <hash_map>
51 #endif
52 
53 #include <boost/math/constants/constants.hpp>
54 #include <iostream>
55 #include <iomanip>
56 
57 using namespace coal;
58 using namespace coal::detail;
59 
62 void generateSelfDistanceEnvironments(std::vector<CollisionObject*>& env,
63  double env_scale, std::size_t n);
64 
67 void generateSelfDistanceEnvironmentsMesh(std::vector<CollisionObject*>& env,
68  double env_scale, std::size_t n);
69 
71 void broad_phase_distance_test(double env_scale, std::size_t env_size,
72  std::size_t query_size, bool use_mesh = false);
73 
75 void broad_phase_self_distance_test(double env_scale, std::size_t env_size,
76  bool use_mesh = false);
77 
79 
80 #if USE_GOOGLEHASH
81 template <typename U, typename V>
82 struct GoogleSparseHashTable
83  : public google::sparse_hash_map<U, V, std::tr1::hash<size_t>,
84  std::equal_to<size_t> > {};
85 
86 template <typename U, typename V>
87 struct GoogleDenseHashTable
88  : public google::dense_hash_map<U, V, std::tr1::hash<size_t>,
89  std::equal_to<size_t> > {
90  GoogleDenseHashTable()
91  : google::dense_hash_map<U, V, std::tr1::hash<size_t>,
92  std::equal_to<size_t> >() {
93  this->set_empty_key(NULL);
94  }
95 };
96 #endif
97 
98 // TODO(jcarpent): fix this test
99 // - test_core_bf_broad_phase_distance
100 
102 BOOST_AUTO_TEST_CASE(test_core_bf_broad_phase_distance) {
103 #ifndef NDEBUG
104  broad_phase_distance_test(200, 100, 10);
105  broad_phase_distance_test(200, 1000, 10);
106  broad_phase_distance_test(2000, 100, 10);
107  broad_phase_distance_test(2000, 1000, 10);
108 #else
109  broad_phase_distance_test(200, 100, 100);
110  broad_phase_distance_test(200, 1000, 100);
111  broad_phase_distance_test(2000, 100, 100);
112  broad_phase_distance_test(2000, 1000, 100);
113 #endif
114 }
115 
117 BOOST_AUTO_TEST_CASE(test_core_bf_broad_phase_self_distance) {
121 }
122 
124 BOOST_AUTO_TEST_CASE(test_core_mesh_bf_broad_phase_distance_mesh) {
125 #ifndef NDEBUG
126  broad_phase_distance_test(200, 10, 10, true);
127  broad_phase_distance_test(200, 100, 10, true);
128  broad_phase_distance_test(2000, 10, 10, true);
129  broad_phase_distance_test(2000, 100, 10, true);
130 #else
131  broad_phase_distance_test(200, 100, 100, true);
132  broad_phase_distance_test(200, 1000, 100, true);
133  broad_phase_distance_test(2000, 100, 100, true);
134  broad_phase_distance_test(2000, 1000, 100, true);
135 #endif
136 }
137 
139 BOOST_AUTO_TEST_CASE(test_core_mesh_bf_broad_phase_self_distance_mesh) {
140  broad_phase_self_distance_test(200, 512, true);
141  broad_phase_self_distance_test(200, 1000, true);
142  broad_phase_self_distance_test(200, 5000, true);
143 }
144 
145 void generateSelfDistanceEnvironments(std::vector<CollisionObject*>& env,
146  double env_scale, std::size_t n) {
147  int n_edge = static_cast<int>(std::floor(std::pow(n, 1 / 3.0)));
148 
149  CoalScalar step_size = env_scale * 2 / n_edge;
150  CoalScalar delta_size = step_size * 0.05;
151  CoalScalar single_size = step_size - 2 * delta_size;
152 
153  int i = 0;
154  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
155  int x = i % (n_edge * n_edge);
156  int y = (i - n_edge * n_edge * x) % n_edge;
157  int z = i - n_edge * n_edge * x - n_edge * y;
158 
159  Box* box = new Box(single_size, single_size, single_size);
160  env.push_back(new CollisionObject(
161  shared_ptr<CollisionGeometry>(box),
163  x * step_size + delta_size + 0.5 * single_size - env_scale,
164  y * step_size + delta_size + 0.5 * single_size - env_scale,
165  z * step_size + delta_size + 0.5 * single_size - env_scale))));
166  env.back()->collisionGeometry()->computeLocalAABB();
167  }
168 
169  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
170  int x = i % (n_edge * n_edge);
171  int y = (i - n_edge * n_edge * x) % n_edge;
172  int z = i - n_edge * n_edge * x - n_edge * y;
173 
174  Sphere* sphere = new Sphere(single_size / 2);
175  env.push_back(new CollisionObject(
176  shared_ptr<CollisionGeometry>(sphere),
178  x * step_size + delta_size + 0.5 * single_size - env_scale,
179  y * step_size + delta_size + 0.5 * single_size - env_scale,
180  z * step_size + delta_size + 0.5 * single_size - env_scale))));
181  env.back()->collisionGeometry()->computeLocalAABB();
182  }
183 
184  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
185  int x = i % (n_edge * n_edge);
186  int y = (i - n_edge * n_edge * x) % n_edge;
187  int z = i - n_edge * n_edge * x - n_edge * y;
188 
189  Cylinder* cylinder = new Cylinder(single_size / 2, single_size);
190  env.push_back(new CollisionObject(
191  shared_ptr<CollisionGeometry>(cylinder),
193  x * step_size + delta_size + 0.5 * single_size - env_scale,
194  y * step_size + delta_size + 0.5 * single_size - env_scale,
195  z * step_size + delta_size + 0.5 * single_size - env_scale))));
196  env.back()->collisionGeometry()->computeLocalAABB();
197  }
198 
199  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
200  int x = i % (n_edge * n_edge);
201  int y = (i - n_edge * n_edge * x) % n_edge;
202  int z = i - n_edge * n_edge * x - n_edge * y;
203 
204  Cone* cone = new Cone(single_size / 2, single_size);
205  env.push_back(new CollisionObject(
206  shared_ptr<CollisionGeometry>(cone),
208  x * step_size + delta_size + 0.5 * single_size - env_scale,
209  y * step_size + delta_size + 0.5 * single_size - env_scale,
210  z * step_size + delta_size + 0.5 * single_size - env_scale))));
211  env.back()->collisionGeometry()->computeLocalAABB();
212  }
213 }
214 
215 void generateSelfDistanceEnvironmentsMesh(std::vector<CollisionObject*>& env,
216  double env_scale, std::size_t n) {
217  int n_edge = static_cast<int>(std::floor(std::pow(n, 1 / 3.0)));
218 
219  CoalScalar step_size = env_scale * 2 / n_edge;
220  CoalScalar delta_size = step_size * 0.05;
221  CoalScalar single_size = step_size - 2 * delta_size;
222 
223  int i = 0;
224  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
225  int x = i % (n_edge * n_edge);
226  int y = (i - n_edge * n_edge * x) % n_edge;
227  int z = i - n_edge * n_edge * x - n_edge * y;
228 
229  Box box(single_size, single_size, single_size);
230  BVHModel<OBBRSS>* model = new BVHModel<OBBRSS>();
231  generateBVHModel(*model, box, Transform3s());
232  env.push_back(new CollisionObject(
233  shared_ptr<CollisionGeometry>(model),
235  x * step_size + delta_size + 0.5 * single_size - env_scale,
236  y * step_size + delta_size + 0.5 * single_size - env_scale,
237  z * step_size + delta_size + 0.5 * single_size - env_scale))));
238  env.back()->collisionGeometry()->computeLocalAABB();
239  }
240 
241  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
242  int x = i % (n_edge * n_edge);
243  int y = (i - n_edge * n_edge * x) % n_edge;
244  int z = i - n_edge * n_edge * x - n_edge * y;
245 
246  Sphere sphere(single_size / 2);
247  BVHModel<OBBRSS>* model = new BVHModel<OBBRSS>();
248  generateBVHModel(*model, sphere, Transform3s(), 16, 16);
249  env.push_back(new CollisionObject(
250  shared_ptr<CollisionGeometry>(model),
252  x * step_size + delta_size + 0.5 * single_size - env_scale,
253  y * step_size + delta_size + 0.5 * single_size - env_scale,
254  z * step_size + delta_size + 0.5 * single_size - env_scale))));
255  env.back()->collisionGeometry()->computeLocalAABB();
256  }
257 
258  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
259  int x = i % (n_edge * n_edge);
260  int y = (i - n_edge * n_edge * x) % n_edge;
261  int z = i - n_edge * n_edge * x - n_edge * y;
262 
263  Cylinder cylinder(single_size / 2, single_size);
264  BVHModel<OBBRSS>* model = new BVHModel<OBBRSS>();
265  generateBVHModel(*model, cylinder, Transform3s(), 16, 16);
266  env.push_back(new CollisionObject(
267  shared_ptr<CollisionGeometry>(model),
269  x * step_size + delta_size + 0.5 * single_size - env_scale,
270  y * step_size + delta_size + 0.5 * single_size - env_scale,
271  z * step_size + delta_size + 0.5 * single_size - env_scale))));
272  env.back()->collisionGeometry()->computeLocalAABB();
273  }
274 
275  for (; i < n_edge * n_edge * n_edge / 4; ++i) {
276  int x = i % (n_edge * n_edge);
277  int y = (i - n_edge * n_edge * x) % n_edge;
278  int z = i - n_edge * n_edge * x - n_edge * y;
279 
280  Cone cone(single_size / 2, single_size);
281  BVHModel<OBBRSS>* model = new BVHModel<OBBRSS>();
282  generateBVHModel(*model, cone, Transform3s(), 16, 16);
283  env.push_back(new CollisionObject(
284  shared_ptr<CollisionGeometry>(model),
286  x * step_size + delta_size + 0.5 * single_size - env_scale,
287  y * step_size + delta_size + 0.5 * single_size - env_scale,
288  z * step_size + delta_size + 0.5 * single_size - env_scale))));
289  env.back()->collisionGeometry()->computeLocalAABB();
290  }
291 }
292 
293 void broad_phase_self_distance_test(double env_scale, std::size_t env_size,
294  bool use_mesh) {
295  std::vector<TStruct> ts;
296  std::vector<BenchTimer> timers;
297 
298  std::vector<CollisionObject*> env;
299  if (use_mesh)
300  generateSelfDistanceEnvironmentsMesh(env, env_scale, env_size);
301  else
302  generateSelfDistanceEnvironments(env, env_scale, env_size);
303 
304  std::vector<BroadPhaseCollisionManager*> managers;
305 
306  managers.push_back(new NaiveCollisionManager());
307  managers.push_back(new SSaPCollisionManager());
308  managers.push_back(new SaPCollisionManager());
309  managers.push_back(new IntervalTreeCollisionManager());
310 
311  Vec3s lower_limit, upper_limit;
312  SpatialHashingCollisionManager<>::computeBound(env, lower_limit, upper_limit);
313  CoalScalar cell_size =
314  std::min(std::min((upper_limit[0] - lower_limit[0]) / 5,
315  (upper_limit[1] - lower_limit[1]) / 5),
316  (upper_limit[2] - lower_limit[2]) / 5);
317  // managers.push_back(new SpatialHashingCollisionManager<>(cell_size,
318  // lower_limit, upper_limit));
319  managers.push_back(new SpatialHashingCollisionManager<
321  cell_size, lower_limit, upper_limit));
322 #if USE_GOOGLEHASH
323  managers.push_back(
325  AABB, CollisionObject*, SpatialHash, GoogleSparseHashTable> >(
326  cell_size, lower_limit, upper_limit));
327  managers.push_back(
329  AABB, CollisionObject*, SpatialHash, GoogleDenseHashTable> >(
330  cell_size, lower_limit, upper_limit));
331 #endif
332  managers.push_back(new DynamicAABBTreeCollisionManager());
333  managers.push_back(new DynamicAABBTreeArrayCollisionManager());
334 
335  {
337  m->tree_init_level = 2;
338  managers.push_back(m);
339  }
340 
341  {
344  m->tree_init_level = 2;
345  managers.push_back(m);
346  }
347 
348  ts.resize(managers.size());
349  timers.resize(managers.size());
350 
351  for (size_t i = 0; i < managers.size(); ++i) {
352  timers[i].start();
353  managers[i]->registerObjects(env);
354  timers[i].stop();
355  ts[i].push_back(timers[i].getElapsedTime());
356  }
357 
358  for (size_t i = 0; i < managers.size(); ++i) {
359  timers[i].start();
360  managers[i]->setup();
361  timers[i].stop();
362  ts[i].push_back(timers[i].getElapsedTime());
363  }
364 
365  std::vector<DistanceCallBackDefault> self_callbacks(managers.size());
366 
367  for (size_t i = 0; i < self_callbacks.size(); ++i) {
368  timers[i].start();
369  managers[i]->distance(&self_callbacks[i]);
370  timers[i].stop();
371  ts[i].push_back(timers[i].getElapsedTime());
372  // std::cout << self_data[i].result.min_distance << " ";
373  }
374  // std::cout << std::endl;
375 
376  for (size_t i = 1; i < managers.size(); ++i)
377  BOOST_CHECK(fabs(self_callbacks[0].data.result.min_distance -
378  self_callbacks[i].data.result.min_distance) < DELTA ||
379  fabs(self_callbacks[0].data.result.min_distance -
380  self_callbacks[i].data.result.min_distance) /
381  fabs(self_callbacks[0].data.result.min_distance) <
382  DELTA);
383 
384  for (size_t i = 0; i < env.size(); ++i) delete env[i];
385 
386  for (size_t i = 0; i < managers.size(); ++i) delete managers[i];
387 
388  std::cout.setf(std::ios_base::left, std::ios_base::adjustfield);
389  int w = 7;
390 
391  std::cout << "self distance timing summary" << std::endl;
392  std::cout << env.size() << " objs" << std::endl;
393  std::cout << "register time" << std::endl;
394  for (size_t i = 0; i < ts.size(); ++i)
395  std::cout << std::setw(w) << ts[i].records[0] << " ";
396  std::cout << std::endl;
397 
398  std::cout << "setup time" << std::endl;
399  for (size_t i = 0; i < ts.size(); ++i)
400  std::cout << std::setw(w) << ts[i].records[1] << " ";
401  std::cout << std::endl;
402 
403  std::cout << "self distance time" << std::endl;
404  for (size_t i = 0; i < ts.size(); ++i)
405  std::cout << std::setw(w) << ts[i].records[2] << " ";
406  std::cout << std::endl;
407 
408  std::cout << "overall time" << std::endl;
409  for (size_t i = 0; i < ts.size(); ++i)
410  std::cout << std::setw(w) << ts[i].overall_time << " ";
411  std::cout << std::endl;
412  std::cout << std::endl;
413 }
414 
415 void broad_phase_distance_test(double env_scale, std::size_t env_size,
416  std::size_t query_size, bool use_mesh) {
417  std::vector<TStruct> ts;
418  std::vector<BenchTimer> timers;
419 
420  std::vector<CollisionObject*> env;
421  if (use_mesh)
422  generateEnvironmentsMesh(env, env_scale, env_size);
423  else
424  generateEnvironments(env, env_scale, env_size);
425 
426  std::vector<CollisionObject*> query;
427 
429  for (std::size_t i = 0; i < env.size(); ++i) manager->registerObject(env[i]);
430  manager->setup();
431 
432  while (1) {
433  std::vector<CollisionObject*> candidates;
434  if (use_mesh)
435  generateEnvironmentsMesh(candidates, env_scale, query_size);
436  else
437  generateEnvironments(candidates, env_scale, query_size);
438 
439  for (std::size_t i = 0; i < candidates.size(); ++i) {
441  manager->collide(candidates[i], &callback);
442  if (callback.data.result.numContacts() == 0)
443  query.push_back(candidates[i]);
444  else
445  delete candidates[i];
446  if (query.size() == query_size) break;
447  }
448 
449  if (query.size() == query_size) break;
450  }
451 
452  delete manager;
453 
454  std::vector<BroadPhaseCollisionManager*> managers;
455 
456  managers.push_back(new NaiveCollisionManager());
457  managers.push_back(new SSaPCollisionManager());
458  managers.push_back(new SaPCollisionManager());
459  managers.push_back(new IntervalTreeCollisionManager());
460 
461  Vec3s lower_limit, upper_limit;
462  SpatialHashingCollisionManager<>::computeBound(env, lower_limit, upper_limit);
463  CoalScalar cell_size =
464  std::min(std::min((upper_limit[0] - lower_limit[0]) / 20,
465  (upper_limit[1] - lower_limit[1]) / 20),
466  (upper_limit[2] - lower_limit[2]) / 20);
467  // managers.push_back(new SpatialHashingCollisionManager<>(cell_size,
468  // lower_limit, upper_limit));
469  managers.push_back(new SpatialHashingCollisionManager<
471  cell_size, lower_limit, upper_limit));
472 #if USE_GOOGLEHASH
473  managers.push_back(
475  AABB, CollisionObject*, SpatialHash, GoogleSparseHashTable> >(
476  cell_size, lower_limit, upper_limit));
477  managers.push_back(
479  AABB, CollisionObject*, SpatialHash, GoogleDenseHashTable> >(
480  cell_size, lower_limit, upper_limit));
481 #endif
482  managers.push_back(new DynamicAABBTreeCollisionManager());
483  managers.push_back(new DynamicAABBTreeArrayCollisionManager());
484 
485  {
487  m->tree_init_level = 2;
488  managers.push_back(m);
489  }
490 
491  {
494  m->tree_init_level = 2;
495  managers.push_back(m);
496  }
497 
498  ts.resize(managers.size());
499  timers.resize(managers.size());
500 
501  for (size_t i = 0; i < managers.size(); ++i) {
502  timers[i].start();
503  managers[i]->registerObjects(env);
504  timers[i].stop();
505  ts[i].push_back(timers[i].getElapsedTime());
506  }
507 
508  for (size_t i = 0; i < managers.size(); ++i) {
509  timers[i].start();
510  managers[i]->setup();
511  timers[i].stop();
512  ts[i].push_back(timers[i].getElapsedTime());
513  }
514 
515  for (size_t i = 0; i < query.size(); ++i) {
516  std::vector<DistanceCallBackDefault> query_callbacks(managers.size());
517  for (size_t j = 0; j < managers.size(); ++j) {
518  timers[j].start();
519  managers[j]->distance(query[i], &query_callbacks[j]);
520  timers[j].stop();
521  ts[j].push_back(timers[j].getElapsedTime());
522  std::cout << query_callbacks[j].data.result.min_distance << " ";
523  }
524  std::cout << std::endl;
525 
526  for (size_t j = 1; j < managers.size(); ++j) {
527  bool test = fabs(query_callbacks[0].data.result.min_distance -
528  query_callbacks[j].data.result.min_distance) < DELTA ||
529  fabs(query_callbacks[0].data.result.min_distance -
530  query_callbacks[j].data.result.min_distance) /
531  fabs(query_callbacks[0].data.result.min_distance) <
532  DELTA;
533  BOOST_CHECK(test);
534 
535  if (!test) {
536  const BroadPhaseCollisionManager& self = *managers[j];
537  std::cout << "j: " << typeid(self).name() << std::endl;
538  std::cout << "query_callbacks[0].data.result.min_distance: "
539  << query_callbacks[0].data.result.min_distance << std::endl;
540  std::cout << "query_callbacks[j].data.result.min_distance: "
541  << query_callbacks[j].data.result.min_distance << std::endl;
542  }
543  }
544  }
545 
546  for (std::size_t i = 0; i < env.size(); ++i) delete env[i];
547  for (std::size_t i = 0; i < query.size(); ++i) delete query[i];
548 
549  for (size_t i = 0; i < managers.size(); ++i) delete managers[i];
550 
551  std::cout.setf(std::ios_base::left, std::ios_base::adjustfield);
552  int w = 7;
553 
554  std::cout << "distance timing summary" << std::endl;
555  std::cout << env_size << " objs, " << query_size << " queries" << std::endl;
556  std::cout << "register time" << std::endl;
557  for (size_t i = 0; i < ts.size(); ++i)
558  std::cout << std::setw(w) << ts[i].records[0] << " ";
559  std::cout << std::endl;
560 
561  std::cout << "setup time" << std::endl;
562  for (size_t i = 0; i < ts.size(); ++i)
563  std::cout << std::setw(w) << ts[i].records[1] << " ";
564  std::cout << std::endl;
565 
566  std::cout << "distance time" << std::endl;
567  for (size_t i = 0; i < ts.size(); ++i) {
568  CoalScalar tmp = 0;
569  for (size_t j = 2; j < ts[i].records.size(); ++j) tmp += ts[i].records[j];
570  std::cout << std::setw(w) << tmp << " ";
571  }
572  std::cout << std::endl;
573 
574  std::cout << "overall time" << std::endl;
575  for (size_t i = 0; i < ts.size(); ++i)
576  std::cout << std::setw(w) << ts[i].overall_time << " ";
577  std::cout << std::endl;
578  std::cout << std::endl;
579 }
coal::SpatialHashingCollisionManager
spatial hashing collision mananger
Definition: coal/broadphase/broadphase_spatialhash.h:54
U
U
generate_distance_plot.m
float m
Definition: generate_distance_plot.py:6
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
V
V
collision_manager.callback
callback
Definition: collision_manager.py:27
collision_manager.box
box
Definition: collision_manager.py:11
test
void test(const Shape &original_shape, const CoalScalar inflation, const CoalScalar tol=1e-8)
Definition: shape_inflation.cpp:111
coal::CollisionCallBackDefault
Default collision callback to check collision between collision objects.
Definition: coal/broadphase/default_broadphase_callbacks.h:196
y
y
coal::DynamicAABBTreeCollisionManager
Definition: coal/broadphase/broadphase_dynamic_AABB_tree.h:53
collision_manager.sphere
sphere
Definition: collision_manager.py:4
coal::BroadPhaseCollisionManager
Base class for broad phase collision. It helps to accelerate the collision/distance between N objects...
Definition: coal/broadphase/broadphase_collision_manager.h:53
coal::generateEnvironments
void generateEnvironments(std::vector< CollisionObject * > &env, CoalScalar env_scale, std::size_t n)
Definition: utility.cpp:392
coal::generateEnvironmentsMesh
void generateEnvironmentsMesh(std::vector< CollisionObject * > &env, CoalScalar env_scale, std::size_t n)
Definition: utility.cpp:423
data
data
coal::detail::SparseHashTable
A hash table implemented using unordered_map.
Definition: coal/broadphase/detail/sparse_hash_table.h:61
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
utility.h
generateSelfDistanceEnvironments
void generateSelfDistanceEnvironments(std::vector< CollisionObject * > &env, double env_scale, std::size_t n)
Generate environment with 3 * n objects for self distance, so we try to make sure none of them collid...
Definition: broadphase.cpp:145
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(test_core_bf_broad_phase_distance)
check broad phase distance
Definition: broadphase.cpp:102
broad_phase_self_distance_test
void broad_phase_self_distance_test(double env_scale, std::size_t env_size, bool use_mesh=false)
test for broad phase self distance
Definition: broadphase.cpp:293
coal::AABB
A class describing the AABB collision structure, which is a box in 3D space determined by two diagona...
Definition: coal/BV/AABB.h:55
coal::Box
Center at zero point, axis aligned box.
Definition: coal/shape/geometric_shapes.h:166
coal::BroadPhaseCollisionManager::setup
virtual void setup()=0
initialize the manager, related with the specific type of manager
coal::Sphere
Center at zero point sphere.
Definition: coal/shape/geometric_shapes.h:240
coal::SSaPCollisionManager
Simple SAP collision manager.
Definition: coal/broadphase/broadphase_SSaP.h:47
coal::Transform3s
Simple transform class used locally by InterpMotion.
Definition: coal/math/transform.h:55
coal::NaiveCollisionManager
Brute force N-body collision manager.
Definition: coal/broadphase/broadphase_bruteforce.h:47
transform.h
coal::DynamicAABBTreeArrayCollisionManager
Definition: coal/broadphase/broadphase_dynamic_AABB_tree_array.h:54
coal::detail::SpatialHash
Spatial hash function: hash an AABB to a set of integer values.
Definition: coal/broadphase/detail/spatial_hash.h:49
coal::IntervalTreeCollisionManager
Collision manager based on interval tree.
Definition: coal/broadphase/broadphase_interval_tree.h:50
x
x
coal::CollisionObject
the object for collision or distance computation, contains the geometry and the transform information
Definition: coal/collision_object.h:214
coal::Cylinder
Cylinder along Z axis. The cylinder is defined at its centroid.
Definition: coal/shape/geometric_shapes.h:560
name
name
DELTA
CoalScalar DELTA
Definition: broadphase.cpp:78
generateSelfDistanceEnvironmentsMesh
void generateSelfDistanceEnvironmentsMesh(std::vector< CollisionObject * > &env, double env_scale, std::size_t n)
Generate environment with 3 * n objects for self distance, but all in meshes.
Definition: broadphase.cpp:215
coal::Cone
Cone The base of the cone is at and the top is at .
Definition: coal/shape/geometric_shapes.h:467
coal::BVHModel
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
Definition: coal/BVH/BVH_model.h:314
coal::SpatialHashingCollisionManager::computeBound
static void computeBound(std::vector< CollisionObject * > &objs, Vec3s &l, Vec3s &u)
compute the bound for the environent
Definition: coal/broadphase/broadphase_spatialhash-inl.h:501
ts
ts
coal::BroadPhaseCollisionManager::registerObject
virtual void registerObject(CollisionObject *obj)=0
add one object to the manager
geometric_shape_to_BVH_model.h
broadphase.h
coal::BroadPhaseCollisionManager::collide
virtual void collide(CollisionObject *obj, CollisionCallBackBase *callback) const =0
perform collision test between one object and all the objects belonging to the manager
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
broad_phase_distance_test
void broad_phase_distance_test(double env_scale, std::size_t env_size, std::size_t query_size, bool use_mesh=false)
test for broad phase distance
Definition: broadphase.cpp:415
coal::generateBVHModel
void generateBVHModel(BVHModel< BV > &model, const Box &shape, const Transform3s &pose)
Generate BVH model from box.
Definition: coal/shape/geometric_shape_to_BVH_model.h:49
coal::detail
Definition: coal/broadphase/broadphase_dynamic_AABB_tree-inl.h:53
coal::SaPCollisionManager
Rigorous SAP collision manager.
Definition: coal/broadphase/broadphase_SaP.h:49


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:57