我希望使用Nef_polyhedron_3构造一个Polyhedron_3对象,而错误描述会发生断言冲突,如下所示:
CGAL error: assertion violation!
Expression : ss_circle.has_on(sp)
File : ***\CGAL\Nef_3\polygon_mesh_to_nef_3.h
Line : 255
Explanation:
Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html以下是简化的代码:
#include <iostream>
#include <vector>
#include <fstream>
#include <future>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
typedef CGAL::Cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
void fill_cube(Polyhedron& poly)
{
std::string input = R"(
OFF
5 5 0
1.10339 0.590945 0.0384615
1.10338 0.590775 0
1.105 0.63 0
1.105 0.63 0.0384615
1.1361 0.609828 0
4 3 2 1 0
3 2 4 1
3 2 3 4
3 3 0 4
3 0 1 4
)";
std::stringstream ss;
ss << input;
ss >> poly;
}
int main()
{
Polyhedron cube;
fill_cube(cube);
CGAL::Polygon_mesh_processing::triangulate_faces(cube);
Nef_polyhedron N(cube);
return 0;
}如果使用Exact_predicates_exact_constructions_kernel,上面的代码可以工作,但是出现了线程安全问题,请参阅我的另一个问题同一多面体中Nef多面体的多线程构造问题。
该程序运行在Windows和VS2019上。
那么我该如何解决这个问题呢?非常感谢。
发布于 2021-06-25 07:15:28
将CGAL::Cartesian<double>替换为内核,代之以精确的结构(如CGAL::Exact_predicates_exact_constructions_kernel )。
更多细节这里
https://stackoverflow.com/questions/68116602
复制相似问题