52 auto end1 = std::upper_bound(start1,
endpoints[0].end(), p);
55 size_t start_id = (size_t)(start1 -
endpoints[0].begin());
56 size_t end_id = (size_t)(end1 -
endpoints[0].begin());
57 size_t cur_id = (size_t)(start_id);
59 for (
size_t i = start_id; i < end_id; ++i) {
75 auto end2 = std::upper_bound(start2,
endpoints[1].end(), p);
78 size_t start_id = (size_t)(start2 -
endpoints[1].begin());
79 size_t end_id = (size_t)(end2 -
endpoints[1].begin());
80 size_t cur_id = (size_t)(start_id);
82 for (
size_t i = start_id; i < end_id; ++i) {
98 auto end3 = std::upper_bound(start3,
endpoints[2].end(), p);
101 size_t start_id = (size_t)(start3 -
endpoints[2].begin());
102 size_t end_id = (size_t)(end3 -
endpoints[2].begin());
103 size_t cur_id = (size_t)(start_id);
105 for (
size_t i = start_id; i < end_id; ++i) {
239 for (
int i = 0; i < 3; ++i) {
242 old_aabb.
min_[i] = it->second->low;
243 old_aabb.
max_[i] = it->second->high;
244 it->second->low = new_aabb.
min_[i];
245 it->second->high = new_aabb.
max_[i];
250 typename std::vector<EndPoint>::iterator it;
251 for (
int i = 0; i < 3; ++i) {
255 if (it->obj == updated_obj && it->minmax == 0) {
256 it->value = new_aabb.
min_[i];
264 if (it->obj == updated_obj && it->minmax == 0) {
265 it->value = new_aabb.
max_[i];
276 const std::vector<CollisionObject*>& updated_objs) {
277 for (
size_t i = 0; i < updated_objs.size(); ++i)
update(updated_objs[i]);
293 for (
int i = 0; i < 3; ++i) {
308 std::vector<CollisionObject*>& objs)
const {
323 if (
size() == 0)
return;
330 static const unsigned int CUTOFF = 100;
332 std::deque<detail::SimpleInterval*> results0, results1, results2;
336 if (results0.size() > CUTOFF) {
339 if (results1.size() > CUTOFF) {
342 if (results2.size() > CUTOFF) {
343 size_t d1 = results0.size();
344 size_t d2 = results1.size();
345 size_t d3 = results2.size();
347 if (
d1 >= d2 &&
d1 >= d3)
349 else if (d2 >=
d1 && d2 >= d3)
365 if (
size() == 0)
return;
366 FCL_REAL min_dist = (std::numeric_limits<FCL_REAL>::max)();
374 static const unsigned int CUTOFF = 100;
378 if (min_dist < (std::numeric_limits<FCL_REAL>::max)()) {
379 Vec3f min_dist_delta(min_dist, min_dist, min_dist);
380 aabb.
expand(min_dist_delta);
387 bool dist_res =
false;
389 old_min_distance = min_dist;
391 std::deque<detail::SimpleInterval*> results0, results1, results2;
394 if (results0.size() > CUTOFF) {
396 if (results1.size() > CUTOFF) {
398 if (results2.size() > CUTOFF) {
399 size_t d1 = results0.size();
400 size_t d2 = results1.size();
401 size_t d3 = results2.size();
403 if (
d1 >= d2 &&
d1 >= d3)
404 dist_res =
checkDist(results0.begin(), results0.end(), obj,
406 else if (d2 >=
d1 && d2 >= d3)
407 dist_res =
checkDist(results1.begin(), results1.end(), obj,
410 dist_res =
checkDist(results2.begin(), results2.end(), obj,
422 if (dist_res)
return true;
429 if (old_min_distance < (std::numeric_limits<FCL_REAL>::max)())
432 if (min_dist < old_min_distance) {
433 Vec3f min_dist_delta(min_dist, min_dist, min_dist);
443 }
else if (status == 0)
454 if (
size() == 0)
return;
456 std::set<CollisionObject*> active;
457 std::set<std::pair<CollisionObject*, CollisionObject*> >
overlap;
464 if (diff_y > diff_x && diff_y > diff_z)
466 else if (diff_z > diff_y && diff_z > diff_x)
469 for (
unsigned int i = 0; i < n; ++i) {
472 if (endpoint.
minmax == 0) {
473 auto iter = active.begin();
474 auto end = active.end();
475 for (; iter != end; ++iter) {
480 int axis2 = (
axis + 1) % 3;
481 int axis3 = (
axis + 2) % 3;
488 if (active_index <
index)
489 insert_res =
overlap.insert(std::make_pair(active_index,
index));
491 insert_res =
overlap.insert(std::make_pair(
index, active_index));
493 if (insert_res.second) {
498 active.insert(
index);
508 if (
size() == 0)
return;
512 FCL_REAL min_dist = (std::numeric_limits<FCL_REAL>::max)();
514 for (
size_t i = 0; i <
endpoints[0].size(); ++i)
529 if ((
size() == 0) || (other_manager->
size() == 0))
return;
531 if (
this == other_manager) {
536 if (this->
size() < other_manager->
size()) {
553 if ((
size() == 0) || (other_manager->
size() == 0))
return;
555 if (
this == other_manager) {
560 FCL_REAL min_dist = (std::numeric_limits<FCL_REAL>::max)();
562 if (this->
size() < other_manager->
size()) {
585 typename std::deque<detail::SimpleInterval*>::const_iterator pos_start,
586 typename std::deque<detail::SimpleInterval*>::const_iterator pos_end,
588 while (pos_start < pos_end) {
590 if (ivl->
obj != obj) {
604 typename std::deque<detail::SimpleInterval*>::const_iterator pos_start,
605 typename std::deque<detail::SimpleInterval*>::const_iterator pos_end,
608 while (pos_start < pos_end) {
610 if (ivl->
obj != obj) {
613 if ((*
callback)(ivl->
obj, obj, min_dist))
return true;
618 if ((*
callback)(ivl->
obj, obj, min_dist))
return true;
642 : detail::SimpleInterval() {