如何将三角剖分的面片转换为曲面网格?

时间:2019-04-19 02:59:14

标签: c++ computational-geometry cgal

我有一个带有顶点和三角形的三角孔贴片。现在如何将其转换为曲面网格?

我正在尝试使用两个不同的补丁部分填充我的网格中的一个孔。我具有边界上所有点(z = 0的点)的顶点位置。使用它们,我使用以下代码(来自https://doc.cgal.org/latest/Polygon_mesh_processing/Polygon_mesh_processing_2triangulate_polyline_example_8cpp-example.html)对孔进行了三角测量

    std::vector<PointCGAL> polyline;
Mesh::Property_map<vertex_descriptor, std::string> name;
Mesh::Property_map<vertex_descriptor, PointCGAL> location = 
    mesh1.points();
BOOST_FOREACH(vertex_descriptor vd, mesh1.vertices()) {
    if (location[vd].z() < 0.00001)
    {
        std::cout << "on Boundary" << endl;
        polyline.push_back(PointCGAL(location[vd].x(), 
    location[vd].y(), location[vd].z()));
    }
    std::cout << location[vd] << std::endl;
}

typedef CGAL::Triple<int, int, int> Triangle_int;
std::vector<Triangle_int> patch;
patch.reserve(polyline.size() - 2); // there will be exactly n-2 
    triangles in the patch
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(
    polyline,
    std::back_inserter(patch));

1 个答案:

答案 0 :(得分:1)