【问题标题】:Assertion violation with 'ss_circle.has_on' when constructing Nef_polyhedron构造 Nef_polyhedron 时与 'ss_circle.has_on' 的断言冲突
【发布时间】:2021-06-24 13:21:02
【问题描述】:

我想使用Polyhedron_3 构造一个Nef_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,上面的代码可以工作,但是出现了线程安全问题,请参阅我的另一个问题Problem with multi-threaded construction of Nef Polyhedrons from a same Polyhedron

程序在 Windows 上运行 VS2019

那么我该如何解决这个问题呢? 非常感谢。

【问题讨论】:

  • 您使用的是double,因此受到所有重大问题的摆布。您需要改用确切的数字类型。虽然最简单的方法是坚持使用 Epeck 而不使用并行性......

标签: c++ cgal


【解决方案1】:

CGAL::Cartesian&lt;double&gt; 替换为具有精确结构的内核,例如CGAL::Exact_predicates_exact_constructions_kernel

更多详情here

【讨论】:

    猜你喜欢
    • 2012-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多