【问题标题】:CGAL polygon mesh processing boolean operations crashCGAL 多边形网格处理布尔运算崩溃
【发布时间】:2019-11-20 13:11:35
【问题描述】:

我想使用 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 和 msvc 2017。我尝试在 PMP::corefine_and_compute_union(mesh1,mesh2, out) 上运行 msvc 调试器,但无济于事......

任何想法为什么会发生这种情况以及如何让它在 MSVC 2017 上运行?

【问题讨论】:

    标签: cgal


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-05
      • 2013-09-20
      • 1970-01-01
      • 1970-01-01
      • 2016-02-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多