gpt4 book ai didi

c++ - 多面体三角剖分失败

转载 作者:太空宇宙 更新时间:2023-11-04 12:39:07 28 4
gpt4 key购买 nike

我正在尝试使用 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 warning: check violation! Expression : false File : /usr/include/CGAL/Constrained_triangulation_2.h Line : 902 Explanation: You are using an exact number type, using a Constrained_triangulation_plus_2 class would avoid cascading intersection computation and be much more efficient This message is shown only if CGAL_NO_CDT_2_WARNINGis not defined.

Refer to the bug-reporting instructions at 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 < poly.off

我不确定三角测量失败是否与警告有关;我如何将 Constrained_triangulation_plus_2 类与 CGAL::Polygon_mesh_processing::triangulate_faces() 一起使用?这可能吗?人脸三角剖分不是什么复杂的事情,怎么会失败呢?

最佳答案

如果您不需要精确的内核,您应该使用 CGAL::Exact_predicates_inexact_constructions_kernel,这将使警告静音,然后三角剖分可能不会失败。如果你确实需要一个确切的内核,你可以使用 CGAL::copy_face_graph()轻松地从 Epeck 切换到 Epeck,进行三角测量,然后切换回 Epeck。

关于c++ - 多面体三角剖分失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55120880/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com