Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] A circulator question...

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] A circulator question...


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] A circulator question...
  • Date: Tue, 03 Jul 2007 18:12:50 +0200

Tyver Ray wrote:
Hello!

I hope you're doing well ^^

How can I get the last element of a Line_face_circulator without scanning all the faces?
In fact, I don't understand the : Line_face_circulator lfc = dt.line_walk(start, end), done(lfc)
done isn't the last face neither a function, so what it is?
Thank you so much helping a newbie :)

Tyv


Hello Tyver,

The notion of iterators comes from the STL. It's the abstraction
of a pointer where you can derefernce, increment, decrement, etc.

The circulator was introduced by the CGAL project. The thing is
that you sometimes have circular structures, for example the
faces incident to a vertex of a 2D triangulation. The vertex
has no list of adjacent faces, but knows only one incident face.
The face itself knows its three neighbor faces. This allows
to walk around the vertex, through the implicit list.
And here the notion of circulators comes in. The Face_circulator
allows to advance face by face around the vertex. As there is
no notion of past the end, it would just wind and wind and
wind around the vertex when you advance it.

That's why with circulators, the typical loop looks like this

Circ circ = X.begin(), done(c1); // done is just a copy
do {
something( *circ);
++circ;
while (circ != done);

With the LFC it's just the same. When you reach the border of
the convex hull, with the next ++ you end up at the other
point of the convex hull where the line intersects it.

hope this helps

andreas




Archive powered by MHonArc 2.6.16.

Top of Page