CGAL::Surface_mesh 在顶点数和面数已知的情况下创建曲面网格

CGAL::Surface_mesh Create surface mesh when number of vertices and faces are known

请问是否可以在我的代码中优化 CGAL 的曲面网格创建? 在下面的循环中,我只是从表示顶点的双平面数组和面 ID 的整数数组中添加顶点和面。

由于已知顶点和面的数量,我是否需要以某种方式保留内存以加快转换速度?在我的工作流程中,它永远不会改变。

CGAL::Surface_mesh<CGAL::Exact_predicates_inexact_constructions_kernel::Point_3> mesh1;

for ( size_t i = 0; i < n_coord_mesh1; i++ ) {
   mesh1.add_vertex (CGAL::Epick::Point_3 (coord_mesh1[3 * i], coord_mesh1[3 * i + 1], coord_mesh1[3 * i + 2]));
}


for ( size_t i = 0; i < n_faces_mesh1; i++ ) {
    mesh1.add_face (CGAL::SM_Vertex_index (faces_mesh1[3 * i + 0]), CGAL::SM_Vertex_index (faces_mesh1[3 * i + 1]), CGAL::SM_Vertex_index (faces_mesh1[3 * i + 2]));
}

您可以在此处使用 Surface_mesh::reserve(),如文档中所示: https://doc.cgal.org/latest/Surface_mesh/classCGAL_1_1Surface__mesh.html#a2172cdbebc27ecf4ca36ac050aad11b8