在基于OpenMesh的OpenFlipper中执行孔填充时,如何删除重复的顶点及其顶点手柄

时间:2018-09-16 01:54:22

标签: duplicates indices vertices openmesh

最近,我正在使用OpenFlipper的插件“漏洞填充”,并且已经完全编译了OpenFlipper。但是,当我尝试将填充面片添加到原始网格时,新网格具有大量重复的顶点。我使用以下代码执行添加操作:

// filling_patch: newly created filling mesh
// mesh_ori: the original mesh before hole filling

class MeshT::FaceHandle fh;
class MeshT::FaceIter f_it, f_end;
class MeshT::FaceVertexIter fv_it;

for(f_it = filling_patch->faces_begin(), f_end = fill_patch ->faces_end(); f_it != f_end; f_it++)
{
   // ith face
   fh = *f_it;

   // Check whether it is valid
   if(!fh.is_valid())
   {
        return;
   }

   // Store its three vertices
   std::vector<class MeshT::VertexHandle> face_vhandles;
   face_vhandles.clear();

   // Iterate each vertex of this face
   for(fv_it = mesh_ori->fv_iter(fh); fv_it.is_valid(); fv_it++)
   {
        // Get the 3D point
        class MeshT::Point p = filling_patch->point(*fv_it);

        // Add this point to original mesh. Note: vh is a new vertevHandle, differ to *fv_it
        class MeshT::VertexHandle vh = mesh_ori->add_vertex(p);

        face_vhandles.push_back(vh);
   }

   // Save the face to mesh
   mesh_ori->add_face(face_vhandles);
}

因此,我不确定OpenMesh中是否存在可用于解决此问题的功能。

有人给我一些建议吗?

非常感谢。

0 个答案:

没有答案