50namespace dynamic_AABB_tree_array {
55template <
typename Derived>
56bool collisionRecurse_(
59 const AABB& root2_bv,
const Eigen::MatrixBase<Derived>& translation2,
69 if (root1->
bv.overlap(root_bv_t)) {
79 return (*callback)(obj1, &obj2);
83 if (collisionRecurse_(nodes1, root1->
children[0], tree2,
nullptr,
84 root2_bv, translation2, callback))
86 if (collisionRecurse_(nodes1, root1->
children[1], tree2,
nullptr,
87 root2_bv, translation2, callback))
96 if (root1->
bv.overlap(root_bv_t)) {
107 return (*callback)(obj1, &obj2);
115 if (tree2->
isNodeFree(root2) || !root1->
bv.overlap(root_bv_t))
return false;
118 (!root1->
isLeaf() && (root1->
bv.size() > root2_bv.
size()))) {
119 if (collisionRecurse_(nodes1, root1->
children[0], tree2, root2, root2_bv,
120 translation2, callback))
122 if (collisionRecurse_(nodes1, root1->
children[1], tree2, root2, root2_bv,
123 translation2, callback))
126 for (
unsigned int i = 0; i < 8; ++i) {
130 computeChildBV(root2_bv, i, child_bv);
132 if (collisionRecurse_(nodes1, root1_id, tree2, child, child_bv,
133 translation2, callback))
137 computeChildBV(root2_bv, i, child_bv);
138 if (collisionRecurse_(nodes1, root1_id, tree2,
nullptr, child_bv,
139 translation2, callback))
149template <
typename Derived>
150bool distanceRecurse_(
153 const AABB& root2_bv,
const Eigen::MatrixBase<Derived>& translation2,
174 (!root1->
isLeaf() && (root1->
bv.size() > root2_bv.
size()))) {
182 if (distanceRecurse_(nodes1, root1->
children[1], tree2, root2, root2_bv,
183 translation2, callback, min_dist))
188 if (distanceRecurse_(nodes1, root1->
children[0], tree2, root2, root2_bv,
189 translation2, callback, min_dist))
194 if (distanceRecurse_(nodes1, root1->
children[0], tree2, root2, root2_bv,
195 translation2, callback, min_dist))
200 if (distanceRecurse_(nodes1, root1->
children[1], tree2, root2, root2_bv,
201 translation2, callback, min_dist))
206 for (
unsigned int i = 0; i < 8; ++i) {
210 computeChildBV(root2_bv, i, child_bv);
213 Scalar d = root1->
bv.distance(aabb2);
216 if (distanceRecurse_(nodes1, root1_id, tree2, child, child_bv,
217 translation2, callback, min_dist))