代码之家  ›  专栏  ›  技术社区  ›  TesX

将Surface_mesh转换为Nef_p多面体_3

  •  2
  • TesX  · 技术社区  · 9 年前

    我正在尝试使用CGAL对网格执行一些布尔运算。

    如何从Surface_mesh转换为Nef_p多面体_3?

    编辑:
    我尝试过使用此代码,但我不知道如何继续。。。

    #include <iostream>
    #include <CGAL/Nef_polyhedron_3.h>
    #include <CGAL/Simple_cartesian.h>
    #include <CGAL/Surface_mesh.h>
    
    using namespace std;
    
    typedef CGAL::Simple_cartesian<double> K;
    typedef CGAL::Surface_mesh<K::Point_3> Mesh;
    
    int main()
    {
        Mesh m;
        auto a = m.add_vertex(K::Point_3(0,0,0));
        auto b = m.add_vertex(K::Point_3(0,0,0));
        auto c = m.add_vertex(K::Point_3(0,0,0));
        m.add_face(a,b,c);
    
        Mesh::Halfedge_range range = m.halfedges();
        for(Mesh::Halfedge_index hei : range)
        {
            // ??? <<--
            std::cout << hei << std::endl;
        }
    
        return 0;
    }
    

    谢谢

    1 回复  |  直到 9 年前
        1
  •  2
  •   Taus    9 年前

    我认为建议的方法是使用三维多面体曲面包。这个 Nef 3 documentation 描述了Polyhedron_3和Nef_3之间的转换。三维多面体曲面包和曲面网格包之间的唯一区别是,它是基于指针的,而不是基于索引的。