Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
457 views
in Technique[技术] by (71.8m points)

collision detection - C++ library for mesh to mesh intersection: what is available?

I need to calculate volume intersection and penetration depth between 3D triangular meshes (e.g. in .obj format), but I am quite new to computational geometry.

In a previous post (Mesh to mesh intersections) and from my google search, I found a few C++ libraries which might be appropriate to do the job:

  • CGAL
  • PQP
  • libigl
  • SWIFT

Though, I am not sure which one could be the most appropriate for a beginner. Any suggestion?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

libigl as of version 1.1 has robust mesh boolean operations in igl/boolean/mesh_boolean.h. This uses either an implementation using CGAL's exact arithmetic kernel or a wrapper of cork (another option for you).

For now, libigl also contains a patched version of cork in libigl/external/cork, which greatly improves robustness.

While implementing libigl's boolean ops, I found that cork is faster but does not always produce the correct result (specifically, it fails to resolve all intersections).

Libigl, using CGAL as a backend, is the most robust and still fast compared to converting a mesh to CGAL's Nef_polyhedron, conducting CSG operations and converting back to a mesh. This final conversion would be possible only if the result is manifold. Instead, libigl only uses CGAL for exact triangle-triangle intersection and 2D meshing. Correct, non-manifold output is no problem.

Libigl's interface is very simple and familiar to users of Eigen. For example, to find the intersection between a solid mesh with vertices in the rows of VA and triangles indices in the rows of FA and another mesh (VB,FB) and store the output in a new mesh (VC,FC):

#include <igl/boolean/mesh_boolean.h>
...
igl::mesh_boolean(VA,FA,VB,FB,MESH_BOOLEAN_TYPE_UNION,VC,FC);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...