Skip to Content.
Sympa Menu

cgal-discuss - Re: Re: [cgal-discuss] About the implementation ofHalfedgeDS_decorator<HDS>::join_vertex

Subject: CGAL users discussion list

List archive

Re: Re: [cgal-discuss] About the implementation ofHalfedgeDS_decorator<HDS>::join_vertex


Chronological Thread 
  • From: "Liyang" <>
  • To: "cgal-discuss" <>
  • Subject: Re: Re: [cgal-discuss] About the implementation ofHalfedgeDS_decorator<HDS>::join_vertex
  • Date: Sun, 19 Aug 2012 21:57:03 +0800


Thank you Sebastien! I understand!
 
 
2012-08-19

Liyang

发件人: Sebastien Loriot (GeometryFactory)
发送时间: 2012-08-19  17:29:56
收件人: cgal-discuss
抄送:
主题: Re: [cgal-discuss] About the implementation ofHalfedgeDS_decorator<HDS>::join_vertex
On 08/14/2012 03:59 AM, Liyang wrote:
> 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)?
The code is correct and the vertex of gprev has been updated.
Indeed, the loop is the following:
while ( h != gprev) {
   CGAL_assertion( ++termination_count != 0);
   h = h->next()->opposite();
   set_vertex( h, get_vertex( hprev));
}
//when I'm here h==gprev which means that the last time I did
// set_vertex, I updated the vertex of h.
Sebastien.
> 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
-- 
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



Archive powered by MHonArc 2.6.18.

Top of Page