broadphase_interval_tree.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-2016, 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 
39 
40 namespace coal {
41 
42 //==============================================================================
44  // must sorted before
45  setup();
46 
47  EndPoint p;
48  p.value = obj->getAABB().min_[0];
49  auto start1 = std::lower_bound(endpoints[0].begin(), endpoints[0].end(), p);
50  p.value = obj->getAABB().max_[0];
51  auto end1 = std::upper_bound(start1, endpoints[0].end(), p);
52 
53  if (start1 < end1) {
54  size_t start_id = (size_t)(start1 - endpoints[0].begin());
55  size_t end_id = (size_t)(end1 - endpoints[0].begin());
56  size_t cur_id = (size_t)(start_id);
57 
58  for (size_t i = start_id; i < end_id; ++i) {
59  if (endpoints[0][(size_t)i].obj != obj) {
60  if (i == cur_id)
61  cur_id++;
62  else {
63  endpoints[0][(size_t)cur_id] = endpoints[0][(size_t)i];
64  cur_id++;
65  }
66  }
67  }
68  if (cur_id < end_id) endpoints[0].resize(endpoints[0].size() - 2);
69  }
70 
71  p.value = obj->getAABB().min_[1];
72  auto start2 = std::lower_bound(endpoints[1].begin(), endpoints[1].end(), p);
73  p.value = obj->getAABB().max_[1];
74  auto end2 = std::upper_bound(start2, endpoints[1].end(), p);
75 
76  if (start2 < end2) {
77  size_t start_id = (size_t)(start2 - endpoints[1].begin());
78  size_t end_id = (size_t)(end2 - endpoints[1].begin());
79  size_t cur_id = (size_t)(start_id);
80 
81  for (size_t i = start_id; i < end_id; ++i) {
82  if (endpoints[1][i].obj != obj) {
83  if (i == cur_id)
84  cur_id++;
85  else {
86  endpoints[1][cur_id] = endpoints[1][i];
87  cur_id++;
88  }
89  }
90  }
91  if (cur_id < end_id) endpoints[1].resize(endpoints[1].size() - 2);
92  }
93 
94  p.value = obj->getAABB().min_[2];
95  auto start3 = std::lower_bound(endpoints[2].begin(), endpoints[2].end(), p);
96  p.value = obj->getAABB().max_[2];
97  auto end3 = std::upper_bound(start3, endpoints[2].end(), p);
98 
99  if (start3 < end3) {
100  size_t start_id = (size_t)(start3 - endpoints[2].begin());
101  size_t end_id = (size_t)(end3 - endpoints[2].begin());
102  size_t cur_id = (size_t)(start_id);
103 
104  for (size_t i = start_id; i < end_id; ++i) {
105  if (endpoints[2][i].obj != obj) {
106  if (i == cur_id)
107  cur_id++;
108  else {
109  endpoints[2][cur_id] = endpoints[2][i];
110  cur_id++;
111  }
112  }
113  }
114  if (cur_id < end_id) endpoints[2].resize(endpoints[2].size() - 2);
115  }
116 
117  // update the interval tree
118  if (obj_interval_maps[0].find(obj) != obj_interval_maps[0].end()) {
119  SAPInterval* ivl1 = obj_interval_maps[0][obj];
120  SAPInterval* ivl2 = obj_interval_maps[1][obj];
121  SAPInterval* ivl3 = obj_interval_maps[2][obj];
122 
123  interval_trees[0]->deleteNode(ivl1);
124  interval_trees[1]->deleteNode(ivl2);
125  interval_trees[2]->deleteNode(ivl3);
126 
127  delete ivl1;
128  delete ivl2;
129  delete ivl3;
130 
131  obj_interval_maps[0].erase(obj);
132  obj_interval_maps[1].erase(obj);
133  obj_interval_maps[2].erase(obj);
134  }
135 }
136 
137 //==============================================================================
139  for (int i = 0; i < 3; ++i) interval_trees[i] = nullptr;
140 }
141 
142 //==============================================================================
144 
145 //==============================================================================
147  EndPoint p, q;
148 
149  p.obj = obj;
150  q.obj = obj;
151  p.minmax = 0;
152  q.minmax = 1;
153  p.value = obj->getAABB().min_[0];
154  q.value = obj->getAABB().max_[0];
155  endpoints[0].push_back(p);
156  endpoints[0].push_back(q);
157 
158  p.value = obj->getAABB().min_[1];
159  q.value = obj->getAABB().max_[1];
160  endpoints[1].push_back(p);
161  endpoints[1].push_back(q);
162 
163  p.value = obj->getAABB().min_[2];
164  q.value = obj->getAABB().max_[2];
165  endpoints[2].push_back(p);
166  endpoints[2].push_back(q);
167  setup_ = false;
168 }
169 
170 //==============================================================================
172  if (!setup_) {
173  std::sort(endpoints[0].begin(), endpoints[0].end());
174  std::sort(endpoints[1].begin(), endpoints[1].end());
175  std::sort(endpoints[2].begin(), endpoints[2].end());
176 
177  for (int i = 0; i < 3; ++i) delete interval_trees[i];
178 
179  for (int i = 0; i < 3; ++i) interval_trees[i] = new detail::IntervalTree;
180 
181  for (size_t i = 0, size = endpoints[0].size(); i < size; ++i) {
182  EndPoint p = endpoints[0][i];
183  CollisionObject* obj = p.obj;
184  if (p.minmax == 0) {
185  SAPInterval* ivl1 = new SAPInterval(obj->getAABB().min_[0],
186  obj->getAABB().max_[0], obj);
187  SAPInterval* ivl2 = new SAPInterval(obj->getAABB().min_[1],
188  obj->getAABB().max_[1], obj);
189  SAPInterval* ivl3 = new SAPInterval(obj->getAABB().min_[2],
190  obj->getAABB().max_[2], obj);
191 
192  interval_trees[0]->insert(ivl1);
193  interval_trees[1]->insert(ivl2);
194  interval_trees[2]->insert(ivl3);
195 
196  obj_interval_maps[0][obj] = ivl1;
197  obj_interval_maps[1][obj] = ivl2;
198  obj_interval_maps[2][obj] = ivl3;
199  }
200  }
201 
202  setup_ = true;
203  }
204 }
205 
206 //==============================================================================
208  setup_ = false;
209 
210  for (size_t i = 0, size = endpoints[0].size(); i < size; ++i) {
211  if (endpoints[0][i].minmax == 0)
212  endpoints[0][i].value = endpoints[0][i].obj->getAABB().min_[0];
213  else
214  endpoints[0][i].value = endpoints[0][i].obj->getAABB().max_[0];
215  }
216 
217  for (size_t i = 0, size = endpoints[1].size(); i < size; ++i) {
218  if (endpoints[1][i].minmax == 0)
219  endpoints[1][i].value = endpoints[1][i].obj->getAABB().min_[1];
220  else
221  endpoints[1][i].value = endpoints[1][i].obj->getAABB().max_[1];
222  }
223 
224  for (size_t i = 0, size = endpoints[2].size(); i < size; ++i) {
225  if (endpoints[2][i].minmax == 0)
226  endpoints[2][i].value = endpoints[2][i].obj->getAABB().min_[2];
227  else
228  endpoints[2][i].value = endpoints[2][i].obj->getAABB().max_[2];
229  }
230 
231  setup();
232 }
233 
234 //==============================================================================
236  AABB old_aabb;
237  const AABB& new_aabb = updated_obj->getAABB();
238  for (int i = 0; i < 3; ++i) {
239  const auto it = obj_interval_maps[i].find(updated_obj);
240  interval_trees[i]->deleteNode(it->second);
241  old_aabb.min_[i] = it->second->low;
242  old_aabb.max_[i] = it->second->high;
243  it->second->low = new_aabb.min_[i];
244  it->second->high = new_aabb.max_[i];
245  interval_trees[i]->insert(it->second);
246  }
247 
248  EndPoint dummy;
249  typename std::vector<EndPoint>::iterator it;
250  for (int i = 0; i < 3; ++i) {
251  dummy.value = old_aabb.min_[i];
252  it = std::lower_bound(endpoints[i].begin(), endpoints[i].end(), dummy);
253  for (; it != endpoints[i].end(); ++it) {
254  if (it->obj == updated_obj && it->minmax == 0) {
255  it->value = new_aabb.min_[i];
256  break;
257  }
258  }
259 
260  dummy.value = old_aabb.max_[i];
261  it = std::lower_bound(endpoints[i].begin(), endpoints[i].end(), dummy);
262  for (; it != endpoints[i].end(); ++it) {
263  if (it->obj == updated_obj && it->minmax == 0) {
264  it->value = new_aabb.max_[i];
265  break;
266  }
267  }
268 
269  std::sort(endpoints[i].begin(), endpoints[i].end());
270  }
271 }
272 
273 //==============================================================================
275  const std::vector<CollisionObject*>& updated_objs) {
276  for (size_t i = 0; i < updated_objs.size(); ++i) update(updated_objs[i]);
277 }
278 
279 //==============================================================================
281  endpoints[0].clear();
282  endpoints[1].clear();
283  endpoints[2].clear();
284 
285  delete interval_trees[0];
286  interval_trees[0] = nullptr;
287  delete interval_trees[1];
288  interval_trees[1] = nullptr;
289  delete interval_trees[2];
290  interval_trees[2] = nullptr;
291 
292  for (int i = 0; i < 3; ++i) {
293  for (auto it = obj_interval_maps[i].cbegin(),
294  end = obj_interval_maps[i].cend();
295  it != end; ++it) {
296  delete it->second;
297  }
298  }
299 
300  for (int i = 0; i < 3; ++i) obj_interval_maps[i].clear();
301 
302  setup_ = false;
303 }
304 
305 //==============================================================================
307  std::vector<CollisionObject*>& objs) const {
308  objs.resize(endpoints[0].size() / 2);
309  size_t j = 0;
310  for (size_t i = 0, size = endpoints[0].size(); i < size; ++i) {
311  if (endpoints[0][i].minmax == 0) {
312  objs[j] = endpoints[0][i].obj;
313  j++;
314  }
315  }
316 }
317 
318 //==============================================================================
321  callback->init();
322  if (size() == 0) return;
323  collide_(obj, callback);
324 }
325 
326 //==============================================================================
329  static const unsigned int CUTOFF = 100;
330 
331  std::deque<detail::SimpleInterval*> results0, results1, results2;
332 
333  results0 =
334  interval_trees[0]->query(obj->getAABB().min_[0], obj->getAABB().max_[0]);
335  if (results0.size() > CUTOFF) {
336  results1 = interval_trees[1]->query(obj->getAABB().min_[1],
337  obj->getAABB().max_[1]);
338  if (results1.size() > CUTOFF) {
339  results2 = interval_trees[2]->query(obj->getAABB().min_[2],
340  obj->getAABB().max_[2]);
341  if (results2.size() > CUTOFF) {
342  size_t d1 = results0.size();
343  size_t d2 = results1.size();
344  size_t d3 = results2.size();
345 
346  if (d1 >= d2 && d1 >= d3)
347  return checkColl(results0.begin(), results0.end(), obj, callback);
348  else if (d2 >= d1 && d2 >= d3)
349  return checkColl(results1.begin(), results1.end(), obj, callback);
350  else
351  return checkColl(results2.begin(), results2.end(), obj, callback);
352  } else
353  return checkColl(results2.begin(), results2.end(), obj, callback);
354  } else
355  return checkColl(results1.begin(), results1.end(), obj, callback);
356  } else
357  return checkColl(results0.begin(), results0.end(), obj, callback);
358 }
359 
360 //==============================================================================
363  callback->init();
364  if (size() == 0) return;
365  CoalScalar min_dist = (std::numeric_limits<CoalScalar>::max)();
366  distance_(obj, callback, min_dist);
367 }
368 
369 //==============================================================================
372  CoalScalar& min_dist) const {
373  static const unsigned int CUTOFF = 100;
374 
375  Vec3s delta = (obj->getAABB().max_ - obj->getAABB().min_) * 0.5;
376  AABB aabb = obj->getAABB();
377  if (min_dist < (std::numeric_limits<CoalScalar>::max)()) {
378  Vec3s min_dist_delta(min_dist, min_dist, min_dist);
379  aabb.expand(min_dist_delta);
380  }
381 
382  int status = 1;
383  CoalScalar old_min_distance;
384 
385  while (1) {
386  bool dist_res = false;
387 
388  old_min_distance = min_dist;
389 
390  std::deque<detail::SimpleInterval*> results0, results1, results2;
391 
392  results0 = interval_trees[0]->query(aabb.min_[0], aabb.max_[0]);
393  if (results0.size() > CUTOFF) {
394  results1 = interval_trees[1]->query(aabb.min_[1], aabb.max_[1]);
395  if (results1.size() > CUTOFF) {
396  results2 = interval_trees[2]->query(aabb.min_[2], aabb.max_[2]);
397  if (results2.size() > CUTOFF) {
398  size_t d1 = results0.size();
399  size_t d2 = results1.size();
400  size_t d3 = results2.size();
401 
402  if (d1 >= d2 && d1 >= d3)
403  dist_res = checkDist(results0.begin(), results0.end(), obj,
404  callback, min_dist);
405  else if (d2 >= d1 && d2 >= d3)
406  dist_res = checkDist(results1.begin(), results1.end(), obj,
407  callback, min_dist);
408  else
409  dist_res = checkDist(results2.begin(), results2.end(), obj,
410  callback, min_dist);
411  } else
412  dist_res = checkDist(results2.begin(), results2.end(), obj, callback,
413  min_dist);
414  } else
415  dist_res = checkDist(results1.begin(), results1.end(), obj, callback,
416  min_dist);
417  } else
418  dist_res =
419  checkDist(results0.begin(), results0.end(), obj, callback, min_dist);
420 
421  if (dist_res) return true;
422 
423  results0.clear();
424  results1.clear();
425  results2.clear();
426 
427  if (status == 1) {
428  if (old_min_distance < (std::numeric_limits<CoalScalar>::max)())
429  break;
430  else {
431  if (min_dist < old_min_distance) {
432  Vec3s min_dist_delta(min_dist, min_dist, min_dist);
433  aabb = AABB(obj->getAABB(), min_dist_delta);
434  status = 0;
435  } else {
436  if (aabb == obj->getAABB())
437  aabb.expand(delta);
438  else
439  aabb.expand(obj->getAABB(), 2.0);
440  }
441  }
442  } else if (status == 0)
443  break;
444  }
445 
446  return false;
447 }
448 
449 //==============================================================================
452  callback->init();
453  if (size() == 0) return;
454 
455  std::set<CollisionObject*> active;
456  std::set<std::pair<CollisionObject*, CollisionObject*> > overlap;
457  size_t n = endpoints[0].size();
458  CoalScalar diff_x = endpoints[0][0].value - endpoints[0][n - 1].value;
459  CoalScalar diff_y = endpoints[1][0].value - endpoints[1][n - 1].value;
460  CoalScalar diff_z = endpoints[2][0].value - endpoints[2][n - 1].value;
461 
462  int axis = 0;
463  if (diff_y > diff_x && diff_y > diff_z)
464  axis = 1;
465  else if (diff_z > diff_y && diff_z > diff_x)
466  axis = 2;
467 
468  for (unsigned int i = 0; i < n; ++i) {
469  const EndPoint& endpoint = endpoints[axis][i];
470  CollisionObject* index = endpoint.obj;
471  if (endpoint.minmax == 0) {
472  auto iter = active.begin();
473  auto end = active.end();
474  for (; iter != end; ++iter) {
475  CollisionObject* active_index = *iter;
476  const AABB& b0 = active_index->getAABB();
477  const AABB& b1 = index->getAABB();
478 
479  int axis2 = (axis + 1) % 3;
480  int axis3 = (axis + 2) % 3;
481 
482  if (b0.axisOverlap(b1, axis2) && b0.axisOverlap(b1, axis3)) {
483  std::pair<typename std::set<std::pair<CollisionObject*,
484  CollisionObject*> >::iterator,
485  bool>
486  insert_res;
487  if (active_index < index)
488  insert_res = overlap.insert(std::make_pair(active_index, index));
489  else
490  insert_res = overlap.insert(std::make_pair(index, active_index));
491 
492  if (insert_res.second) {
493  if ((*callback)(active_index, index)) return;
494  }
495  }
496  }
497  active.insert(index);
498  } else
499  active.erase(index);
500  }
501 }
502 
503 //==============================================================================
506  callback->init();
507  if (size() == 0) return;
508 
509  this->enable_tested_set_ = true;
510  this->tested_set.clear();
511  CoalScalar min_dist = (std::numeric_limits<CoalScalar>::max)();
512 
513  for (size_t i = 0; i < endpoints[0].size(); ++i)
514  if (distance_(endpoints[0][i].obj, callback, min_dist)) break;
515 
516  this->enable_tested_set_ = false;
517  this->tested_set.clear();
518 }
519 
520 //==============================================================================
522  BroadPhaseCollisionManager* other_manager_,
524  callback->init();
525  IntervalTreeCollisionManager* other_manager =
526  static_cast<IntervalTreeCollisionManager*>(other_manager_);
527 
528  if ((size() == 0) || (other_manager->size() == 0)) return;
529 
530  if (this == other_manager) {
531  collide(callback);
532  return;
533  }
534 
535  if (this->size() < other_manager->size()) {
536  for (size_t i = 0, size = endpoints[0].size(); i < size; ++i)
537  if (other_manager->collide_(endpoints[0][i].obj, callback)) return;
538  } else {
539  for (size_t i = 0, size = other_manager->endpoints[0].size(); i < size; ++i)
540  if (collide_(other_manager->endpoints[0][i].obj, callback)) return;
541  }
542 }
543 
544 //==============================================================================
546  BroadPhaseCollisionManager* other_manager_,
548  callback->init();
549  IntervalTreeCollisionManager* other_manager =
550  static_cast<IntervalTreeCollisionManager*>(other_manager_);
551 
552  if ((size() == 0) || (other_manager->size() == 0)) return;
553 
554  if (this == other_manager) {
556  return;
557  }
558 
559  CoalScalar min_dist = (std::numeric_limits<CoalScalar>::max)();
560 
561  if (this->size() < other_manager->size()) {
562  for (size_t i = 0, size = endpoints[0].size(); i < size; ++i)
563  if (other_manager->distance_(endpoints[0][i].obj, callback, min_dist))
564  return;
565  } else {
566  for (size_t i = 0, size = other_manager->endpoints[0].size(); i < size; ++i)
567  if (distance_(other_manager->endpoints[0][i].obj, callback, min_dist))
568  return;
569  }
570 }
571 
572 //==============================================================================
574  return endpoints[0].empty();
575 }
576 
577 //==============================================================================
579  return endpoints[0].size() / 2;
580 }
581 
582 //==============================================================================
584  typename std::deque<detail::SimpleInterval*>::const_iterator pos_start,
585  typename std::deque<detail::SimpleInterval*>::const_iterator pos_end,
587  while (pos_start < pos_end) {
588  SAPInterval* ivl = static_cast<SAPInterval*>(*pos_start);
589  if (ivl->obj != obj) {
590  if (ivl->obj->getAABB().overlap(obj->getAABB())) {
591  if ((*callback)(ivl->obj, obj)) return true;
592  }
593  }
594 
595  pos_start++;
596  }
597 
598  return false;
599 }
600 
601 //==============================================================================
603  typename std::deque<detail::SimpleInterval*>::const_iterator pos_start,
604  typename std::deque<detail::SimpleInterval*>::const_iterator pos_end,
606  CoalScalar& min_dist) const {
607  while (pos_start < pos_end) {
608  SAPInterval* ivl = static_cast<SAPInterval*>(*pos_start);
609  if (ivl->obj != obj) {
610  if (!this->enable_tested_set_) {
611  if (ivl->obj->getAABB().distance(obj->getAABB()) < min_dist) {
612  if ((*callback)(ivl->obj, obj, min_dist)) return true;
613  }
614  } else {
615  if (!this->inTestedSet(ivl->obj, obj)) {
616  if (ivl->obj->getAABB().distance(obj->getAABB()) < min_dist) {
617  if ((*callback)(ivl->obj, obj, min_dist)) return true;
618  }
619 
620  this->insertTestedSet(ivl->obj, obj);
621  }
622  }
623  }
624 
625  pos_start++;
626  }
627 
628  return false;
629 }
630 
631 //==============================================================================
633  const typename IntervalTreeCollisionManager::EndPoint& p) const {
634  return value < p.value;
635 }
636 
637 //==============================================================================
639  CoalScalar high_,
640  CollisionObject* obj_)
641  : detail::SimpleInterval() {
642  this->low = low_;
643  this->high = high_;
644  obj = obj_;
645 }
646 
647 } // namespace coal
coal::IntervalTreeCollisionManager::obj_interval_maps
std::map< CollisionObject *, SAPInterval * > obj_interval_maps[3]
Definition: coal/broadphase/broadphase_interval_tree.h:161
coal::IntervalTreeCollisionManager::EndPoint::obj
CollisionObject * obj
object related with the end point
Definition: coal/broadphase/broadphase_interval_tree.h:119
coal::IntervalTreeCollisionManager::checkColl
bool checkColl(typename std::deque< detail::SimpleInterval * >::const_iterator pos_start, typename std::deque< detail::SimpleInterval * >::const_iterator pos_end, CollisionObject *obj, CollisionCallBackBase *callback) const
Definition: broadphase_interval_tree.cpp:583
coal::IntervalTreeCollisionManager::distance_
bool distance_(CollisionObject *obj, DistanceCallBackBase *callback, CoalScalar &min_dist) const
Definition: broadphase_interval_tree.cpp:370
coal::IntervalTreeCollisionManager::EndPoint::value
CoalScalar value
end point value
Definition: coal/broadphase/broadphase_interval_tree.h:122
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
coal::detail::IntervalTree::insert
IntervalTreeNode * insert(SimpleInterval *new_interval)
Insert one node of the interval tree.
Definition: interval_tree.cpp:183
geometric_shapes.d1
float d1
Definition: scripts/geometric_shapes.py:31
collision_manager.callback
callback
Definition: collision_manager.py:27
coal::detail::IntervalTree
Interval tree.
Definition: coal/broadphase/detail/interval_tree.h:63
coal::minmax
void minmax(CoalScalar a, CoalScalar b, CoalScalar &minv, CoalScalar &maxv)
Find the smaller and larger one of two values.
Definition: kDOP.cpp:47
coal::detail::IntervalTree::query
std::deque< SimpleInterval * > query(CoalScalar low, CoalScalar high)
Return result for a given query.
Definition: interval_tree.cpp:421
coal::AABB::distance
CoalScalar distance(const AABB &other) const
Distance between two AABBs.
Definition: AABB.cpp:114
doxygen_xml_parser.index
index
Definition: doxygen_xml_parser.py:889
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::IntervalTreeCollisionManager::empty
bool empty() const
whether the manager is empty
Definition: broadphase_interval_tree.cpp:573
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::BroadPhaseCollisionManager::getObjects
virtual std::vector< CollisionObject * > getObjects() const
return the objects managed by the manager
Definition: coal/broadphase/broadphase_collision_manager.h:87
coal::IntervalTreeCollisionManager::collide
void collide(CollisionObject *obj, CollisionCallBackBase *callback) const
perform collision test between one object and all the objects belonging to the manager
Definition: broadphase_interval_tree.cpp:319
coal::IntervalTreeCollisionManager::unregisterObject
void unregisterObject(CollisionObject *obj)
add one object to the manager
Definition: broadphase_interval_tree.cpp:43
coal::BroadPhaseCollisionManager::enable_tested_set_
bool enable_tested_set_
Definition: coal/broadphase/broadphase_collision_manager.h:130
coal::IntervalTreeCollisionManager::collide_
bool collide_(CollisionObject *obj, CollisionCallBackBase *callback) const
Definition: broadphase_interval_tree.cpp:327
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::detail::SimpleInterval::low
CoalScalar low
interval is defined as [low, high]
Definition: coal/broadphase/detail/simple_interval.h:56
coal::IntervalTreeCollisionManager::EndPoint
SAP end point.
Definition: coal/broadphase/broadphase_interval_tree.h:117
coal::AABB::max_
Vec3s max_
The max point in the AABB.
Definition: coal/BV/AABB.h:60
coal::AABB::overlap
bool overlap(const AABB &other) const
Check whether two AABB are overlap.
Definition: coal/BV/AABB.h:111
coal::IntervalTreeCollisionManager::SAPInterval::obj
CollisionObject * obj
Definition: coal/broadphase/broadphase_interval_tree.h:134
coal::IntervalTreeCollisionManager::size
size_t size() const
the number of objects managed by the manager
Definition: broadphase_interval_tree.cpp:578
coal::IntervalTreeCollisionManager::update
virtual void update()
update the condition of manager
Definition: broadphase_interval_tree.cpp:207
coal::IntervalTreeCollisionManager::distance
void distance(CollisionObject *obj, DistanceCallBackBase *callback) const
perform distance computation between one object and all the objects belonging to the manager
Definition: broadphase_interval_tree.cpp:361
coal::IntervalTreeCollisionManager
Collision manager based on interval tree.
Definition: coal/broadphase/broadphase_interval_tree.h:50
coal::DistanceCallBackBase
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
Definition: coal/broadphase/broadphase_callbacks.h:72
coal::CollisionObject
the object for collision or distance computation, contains the geometry and the transform information
Definition: coal/collision_object.h:214
coal::BroadPhaseCollisionManager::tested_set
std::set< std::pair< CollisionObject *, CollisionObject * > > tested_set
tools help to avoid repeating collision or distance callback for the pairs of objects tested before....
Definition: coal/broadphase/broadphase_collision_manager.h:129
axis
axis
coal::CollisionObject::getAABB
const AABB & getAABB() const
get the AABB in world space
Definition: coal/collision_object.h:252
q
q
coal::IntervalTreeCollisionManager::SAPInterval::SAPInterval
SAPInterval(CoalScalar low_, CoalScalar high_, CollisionObject *obj_)
Definition: broadphase_interval_tree.cpp:638
coal::overlap
COAL_DLLAPI bool overlap(const Matrix3s &R0, const Vec3s &T0, const AABB &b1, const AABB &b2)
Check collision between two aabbs, b1 is in configuration (R0, T0) and b2 is in identity.
Definition: AABB.cpp:134
coal::IntervalTreeCollisionManager::setup
void setup()
initialize the manager, related with the specific type of manager
Definition: broadphase_interval_tree.cpp:171
coal::IntervalTreeCollisionManager::EndPoint::operator<
bool operator<(const EndPoint &p) const
Definition: broadphase_interval_tree.cpp:632
coal::AABB::min_
Vec3s min_
The min point in the AABB.
Definition: coal/BV/AABB.h:58
coal::IntervalTreeCollisionManager::SAPInterval
Extention interval tree's interval to SAP interval, adding more information.
Definition: coal/broadphase/broadphase_interval_tree.h:133
coal::IntervalTreeCollisionManager::clear
void clear()
clear the manager
Definition: broadphase_interval_tree.cpp:280
coal::AABB::axisOverlap
bool axisOverlap(const AABB &other, int axis_id) const
Check whether two AABB are overlapped along specific axis.
Definition: coal/BV/AABB.h:199
coal::IntervalTreeCollisionManager::EndPoint::minmax
char minmax
tag for whether it is a lower bound or higher bound of an interval, 0 for lo, and 1 for hi
Definition: coal/broadphase/broadphase_interval_tree.h:126
coal::BroadPhaseCollisionManager::insertTestedSet
void insertTestedSet(CollisionObject *a, CollisionObject *b) const
Definition: broadphase_collision_manager.cpp:84
coal::IntervalTreeCollisionManager::registerObject
void registerObject(CollisionObject *obj)
remove one object from the manager
Definition: broadphase_interval_tree.cpp:146
coal::IntervalTreeCollisionManager::endpoints
std::vector< EndPoint > endpoints[3]
vector stores all the end points
Definition: coal/broadphase/broadphase_interval_tree.h:156
coal::IntervalTreeCollisionManager::checkDist
bool checkDist(typename std::deque< detail::SimpleInterval * >::const_iterator pos_start, typename std::deque< detail::SimpleInterval * >::const_iterator pos_end, CollisionObject *obj, DistanceCallBackBase *callback, CoalScalar &min_dist) const
Definition: broadphase_interval_tree.cpp:602
coal::IntervalTreeCollisionManager::~IntervalTreeCollisionManager
~IntervalTreeCollisionManager()
Definition: broadphase_interval_tree.cpp:143
coal::IntervalTreeCollisionManager::setup_
bool setup_
tag for whether the interval tree is maintained suitably
Definition: coal/broadphase/broadphase_interval_tree.h:164
coal::detail::IntervalTree::deleteNode
SimpleInterval * deleteNode(IntervalTreeNode *node)
Delete one node of the interval tree.
Definition: interval_tree.cpp:362
coal::CollisionCallBackBase
Base callback class for collision queries. This class can be supersed by child classes to provide des...
Definition: coal/broadphase/broadphase_callbacks.h:49
coal::IntervalTreeCollisionManager::interval_trees
detail::IntervalTree * interval_trees[3]
interval tree manages the intervals
Definition: coal/broadphase/broadphase_interval_tree.h:159
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
coal::AABB::expand
AABB & expand(const Vec3s &delta)
expand the half size of the AABB by delta, and keep the center unchanged.
Definition: coal/BV/AABB.h:208
coal::BroadPhaseCollisionManager::inTestedSet
bool inTestedSet(CollisionObject *a, CollisionObject *b) const
Definition: broadphase_collision_manager.cpp:75
coal::IntervalTreeCollisionManager::IntervalTreeCollisionManager
IntervalTreeCollisionManager()
Definition: broadphase_interval_tree.cpp:138
broadphase_interval_tree.h
coal::detail::SimpleInterval::high
CoalScalar high
Definition: coal/broadphase/detail/simple_interval.h:56


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