我试图使用CGAL 4.13和以下代码片段对多面体的面进行三角测量,该代码片段在stdin上采用OFF格式的多面体定义文件:
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
using namespace std;
int main (void) {
Polyhedron p;
cin >> p;
if (!CGAL::Polygon_mesh_processing::triangulate_faces(p))
cerr << p << endl << "Triangulation failed!" << endl;
}
但是,我发现以下警告:
CGAL警告:检查违规!表达式:false文件:/usr/include/CGAL/Constrained_triangulation_2.h行:902说明:您使用的是精确数字类型,使用Constrained_triangulation_plus_2类可以避免级联交集计算并且效率更高只有CGAL_NO_CDT_2_WARNING不能显示此消息定义。
请参阅https://www.cgal.org/bug_report.html上的错误报告说明
并且三角测量失败了。打印消息Triangulation failed!
以及多面体定义,它清楚地显示了一些具有5个甚至7个顶点的面。
不幸的是,多面体的OFF表示长度为8070行,我没有创建一个较小的例子来重现该问题。所以我上传了here。它只有30天可用,如果有人可以建议一个更好的上传位置,我会考虑。
编译后,例如用
g ++ -Oz three.kpp -o three -lChGAL -lgmp -lmpfr -Vall
这个问题可以转载
./三<flooring.off
我不确定三角测量的失败是否与警告有关;我如何使用Constrained_triangulation_plus_2
类与CGAL::Polygon_mesh_processing::triangulate_faces()
?这有可能吗?面部的三角测量并不是一件复杂的事情,这首先如何失败呢?
如果你不需要一个确切的内核,你应该使用CGAL::Exact_predicates_inexact_constructions_kernel
,它会使警告静音,然后三角测量可能不会失败。如果你确实需要一个精确的内核,你可以使用CGAL::copy_face_graph()
轻松地从Epeck切换到Epick,三角测量,然后切换回Epeck。