I\'m looking for a library or a paper that describes how to determine if one triangular mesh intersects another.
Interestingly I am coming up empty. If there is some
In libigl, we wrap up cgal's CGAL::box_intersection_d
to intersect a mesh with vertices V
and faces F
with another mesh with vertices U
and faces G
, storing pairs of intersecting facets as rows in IF
:
igl::intersect_other(V,F,U,G,false,IF);
This will ignore self-intersections. For completeness, I'll mention that we also support self-intersections in a separate function:
igl::self_intersect(V,F,...,IF);
The book Real-Time Collision Detection has some good suggestions for implementing such algorithms. The basic approach is to use spatial partitioning or bounding volumes to reduce the number of tri-tri intersection tests that you need to perform.
There are a number of good academic packages that address this problem including the Proximity Query Package, and the other work of the GAMMA research group at University of North Carolina, SWIFT, I-COLLIDE, and RAPID are all well known. Check that the licenses on these libraries are acceptable.
The Open Dynamics Engine (ODE), is a physics engine that contains optimized implementations of a large number of intersection primitives. You can check out the documentation for the triangle-triangle intersection test on their wiki.
While it isn't exactly what you're looking for, I believe that this is also possible with CGAL - Tree of Triangles, for Intersection and Distance Queries
The way we usually do it using CGAL is with CGAL::box_intersection_d.
You can make it by mixing this example with this one.
EDIT:
Since CGAL 4.12 there is now the function CGAL::Polygon_mesh_processing::do_intersect().
To add to the other answers, there are also techniques involving the 3D Minkowski sum of convex polyhedra - concave polyhedra can be decomposed into convex parts. Check out this.
I think the search term you are missing is overlay. For example, here is a web page on Surface Mesh Overlay. That site has a short bibliography, all by the same authors. Here is another paper on the topic: "Overlay mesh construction using interleaved spanning trees," INFOCOM 2004: Twenty-third Annual Joint Conference of the IEEE Computer and Communications Societies. See also the GIS SE question, "Performing Overlay of Two Triangulated Irregular Networks (TIN)."