【问题标题】:CGAL - how to use CGAL::Polygon_mesh_processing::connected_components to convert one CGAL::Surface_mesh into many?CGAL - 如何使用 CGAL::Polygon_mesh_processing::connected_components 将一个 CGAL::Surface_mesh 转换为多个?
【发布时间】:2019-02-09 18:07:14
【问题描述】:

我正在创建一个网格实用程序库,我想要包含的功能之一是能够拆分网格的不相交分区。为此,我正在尝试编写一个接收CGAL::Surface_mesh 并返回std::vector<CGAL::Surface_mesh> 的方法,其中每个元素都是输入网格的连接组件。

我看到 CGAL 具有CGAL::Polygon_mesh_processing::connected components 功能,但这似乎只是为每个面分配了一个标签,表明它是哪个组件的一部分。如何使用该操作的结果从具有相同标签的每组人脸中构造一个新的CGAL::Surface_mesh

【问题讨论】:

    标签: c++ c graph mesh cgal


    【解决方案1】:

    一种方法是使用connected_components() 的结果作为the Face_filtered_graph 的输入参数。 我相信你可以做类似的事情:

     FCCmap fccmap = mesh.add_property_map<face_descriptor, faces_size_type> 
                     ("f:CC").first;
     faces_size_type num = PMP::connected_components(mesh,fccmap); 
     std::vector<Mesh> meshes(num);
     for(int i=0; i< num; ++i)
     {
       Filtered_graph ffg(mesh, i, fccmap);
       CGAL::copy_face_graph(ffg, meshes[i]);
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2014-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多