【发布时间】:2019-03-12 11:55:09
【问题描述】:
我正在尝试使用 CGAL 4.13 和以下代码 sn-p 对多面体的面进行三角剖分,该代码在标准输入上采用 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 警告:检查违规!表达式:假文件: /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++ -O3 tri.cpp -o tri -lCGAL -lgmp -lmpfr -Wall
这个问题可以用
重现./tri
我不确定三角测量失败是否与警告有关;我如何将Constrained_triangulation_plus_2 类与CGAL::Polygon_mesh_processing::triangulate_faces() 一起使用?这可能吗?人脸三角剖分不是什么复杂的事情,怎么会失败呢?
【问题讨论】:
标签: c++ cgal triangulation polyhedra