humanoid-path-planner / hpp-fcl

An extension of the Flexible Collision Library
Other
300 stars 90 forks source link

TODO: avoid BVH-BVH copy in `collide`? #559

Open lmontaut opened 6 months ago

lmontaut commented 6 months ago

BVH-BVH makes a full copy of both BVHs + BV fitting before calling collide: https://github.com/humanoid-path-planner/hpp-fcl/blob/aa3c40a994b44c1d9ea1f007ff07999a016fe61c/src/collision_func_matrix.cpp#L214-L229

Doing this not only copies two BVHs (which can have thousands or even hundreds of thousands of vertices) but also fits them with a new BVs structure. I think the original idea was to transform both BVH in the world frame, hence avoiding having to transform each AABB when doing the collision between leafs of the BVHs.

In practice, when doing BVH-BVH collision, there are only a few AABB collision checks, and transforming an AABB is very cheap. Is it really worth copying/fitting two BVHs in order to avoid these on-the-fly transformations?