CGAL surface mesh - removing face

2019-06-04 02:10发布

问题:

  1. Does the remove_face method change the mesh indices?

I get a segmentation fault with this code:

        auto face_iterator = m.faces_around_target(m.halfedge(v3));

            for (auto i=face_iterator.begin(); i!=face_iterator.end(); i++) {
                m.remove_face(*i);
            }

According to my understanding of the documentation, as long as I don't call collect_garbage the faces are only marked as removed., therefore no changes to indices. What is happening?

  1. Does remove_face, also remove the face halfedges\ makes them point to null_face? It does not seem to do so, and I don't understand why not..

Thank you.

回答1:

The face is indeed simply marked as removed but its iterator is invalidated by the removal (remember that iterator goes only over non-removed elements).

As stated in the doc: removes face f from the halfedge data structure without adjusting anything. You need to use a higher level function such as CGAL::Euler::remove_face().



标签: mesh cgal