网格到网格相交的C ++库:有哪些可用? [英] C++ library for mesh to mesh intersection: what is available?

查看:117
本文介绍了网格到网格相交的C ++库:有哪些可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要计算3D三角形网格之间的体积相交和穿透深度(例如.obj格式),但是我对计算几何学还是很陌生的.

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.

在上一篇文章(网状到网状相交)和我的google搜索中,我发现了一些可能适合此工作的C ++库:

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?

推荐答案

libigl igl/boolean/mesh_boolean.h中.这可以使用使用CGAL的精确算术内核的实现,也可以使用软木塞(您的另一种选择)的包装.

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).

就目前而言,libigl在libigl/external/cork中还包含补丁版本的软木塞,可大大提高鲁棒性.

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

在实施libigl的布尔操作时,我发现软木塞速度更快,但并不总是能产生正确的结果(特别是,它无法解决所有的交集).

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是最健壮且仍然最快的.仅当结果是多方面的时,才可能进行最终转换.取而代之的是,libigl仅将CGAL用于精确的三角形-三角形相交和2D网格划分.正确的非流形输出没问题.

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的界面非常简单, Eigen 的用户也非常熟悉.例如,要查找在VA行中具有顶点的实心网格与在FA行中具有三角形索引的实心网格与另一个网格(VB,FB)之间的交集,并将输出存储在新的网格(VC,FC)中:

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);

这篇关于网格到网格相交的C ++库:有哪些可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆