[CGAL多边形网格处理布尔操作崩溃

问题描述 投票:0回答:1

我想使用CGAL的多边形网格处理包对两个网格执行布尔运算。问题是corefinement_and_union示例崩溃:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/corefinement.h>


#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3>             Mesh;

namespace PMP = CGAL::Polygon_mesh_processing;

int main(int argc, char* argv[])
{
  const char* filename1 = (argc > 1) ? argv[1] : "blobby.off";
  const char* filename2 = (argc > 2) ? argv[2] : "eight.off";
  std::ifstream input1(filename1);
  std::ifstream input2(filename2);

  Mesh mesh1, mesh2;

  input1 >> mesh1;

  std::cout << mesh1.number_of_vertices() << std::endl; //mesh1 input OK

  input1.close();
  input2 >> mesh2;
  input2.close();

  std::cout << mesh2.number_of_vertices() << std::endl; //mesh2 input OK

  Mesh out;
  bool valid_union = PMP::corefine_and_compute_union(mesh1,mesh2, out); //crashes

  if (valid_union)
  {
    std::cout << "Union was successfully computed\n";
    std::ofstream output("union.off");
    output << out;
    return 0;
  }
  std::cout << "Union could not be computed\n";
  return 1;
}

我正在使用cgal 5.0作为仅标头的库,带有boost 1.71.0 v14.1,Eigen 3.3.7和msvc2017。我尝试在PMP :: corefine_and_compute_union(mesh1,mesh2,out)上运行msvc调试器,但无济于事...

关于为什么会发生这种情况以及如何使其在MSVC 2017上起作用的任何想法?

cgal
1个回答
0
投票

如果您阅读documention,您将看到必须满足一些先决条件。您的输入网格之一很可能具有一些自相交。在同一文档页面上,您还将找到命名参数throw_on_self_intersection,如果将其设置为true,则该输入将使函数引发异常,以防您的输入在交点附近具有自交点。

© www.soinside.com 2019 - 2024. All rights reserved.