Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] About the implementation of HalfedgeDS_decorator<HDS>::join_vertex

Subject: CGAL users discussion list

List archive

[cgal-discuss] About the implementation of HalfedgeDS_decorator<HDS>::join_vertex


Chronological Thread 
  • From: "Liyang" <>
  • To: "cgal-discuss-new" <>
  • Subject: [cgal-discuss] About the implementation of HalfedgeDS_decorator<HDS>::join_vertex
  • Date: Tue, 14 Aug 2012 09:59:53 +0800

Hi experts,
 
I'm reading the code of HalfedgeDS_decorator<HDS>::join_vertex , the question is, after the loop(while(h!=gprev)...), all halfedges previously pointed to get_vertex(gprev) but gprev have pointed to get_vertex(hprev), don't we need to make gprev point to get_vertex(hprev)?
 
Thank you for your attention and sorry for my poor English.
 
Best regards.
 
 
/*                            The codes are as follow                       */
Halfedge_handle join_vertex( Halfedge_handle h) {
        // joins the two vertices incident to h. The vertex denoted by
        // `h->opposite()' gets removed by `hds'. Returns the predecessor
        // of h around the vertex. The invariant `join_vertex(
        // split_vertex( h, g))' returns h and keeps the polyhedron
        // unchanged. The time is proportional to the degree of the vertex
        // removed and the time to compute `h->prev()'. Precondition:
        // `Supports_removal' == `Tag_true'.
        Assert_compile_time_tag( Tag_true(), Supports_removal());
        Halfedge_handle hprev = find_prev( h->opposite());
        Halfedge_handle gprev = find_prev( h);
        remove_halfedge( hprev);
        remove_halfedge( gprev);
        hds->edges_erase( h);
        vertices_erase( get_vertex( gprev));
        // 'half' of the halfedges have their correct vertex.
        // Here we do the remaining halfedges.
        h = hprev;
        CGAL_assertion_code( std::size_t termination_count = 0;)
        while ( h != gprev) {
            CGAL_assertion( ++termination_count != 0);
            h = h->next()->opposite();
            set_vertex( h, get_vertex( hprev));
        }
        set_vertex_halfedge( hprev);
        if ( ! hprev->is_border())
            set_face_halfedge(  hprev);
        if ( ! gprev->is_border())
            set_face_halfedge(  gprev);
        return hprev;
    }
2012-08-14

Liyang



Archive powered by MHonArc 2.6.18.

Top of Page