Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 2D Arrangements

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 2D Arrangements


Chronological Thread 
  • From: Efi Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] 2D Arrangements
  • Date: Sun, 26 Aug 2007 00:05:29 +0200

You can be sure.

Lev Borovoi wrote:
There's one more thing I'm afraid of. If the arrangement changes, can I
be sure that I won't iterate over the same edge twice? Or, conversely,
miss one of the edges even though it's not deleted?

-----Original Message-----
From: Efraim Fogel [mailto:] Sent: Thursday, August 23, 2007 10:43 AM
To:

Cc: Ron Wein
Subject: Re: [cgal-discuss] 2D Arrangements

Here are the answers to your questions assembled by Ron:

In general, as long as you do not remove things, your iterators stay valid. Removing an edge will of course invalidate the iterators/handles to the two deleted halfedges, but it can also
happen that this causes two faces to merge, and in such a case also some

face handle is invalidated.

Regarding the specific program, there is a problem with it, as the loop goes over the halfedges. When you delete a halfedge, you also deleted its twin, which is in general the next halfedge in the container, so you

get an invalid iterator. The solution is easy: Use an edge iterator
instead.

Arrangement arr;
Arrangement::Edge_iterator iter = arr.edges_begin();

while (iter != arr.edges_end())
{
if (SomeCondition(*iter))
{
Arrangement::Edge_iterator t = iter;
iter++;
arr.remove_edge(t);
}
else
iter++;
}

One face is deleted in case of a merge. If the arrangement faces are extended with external data, you can use an observer to keep track of the changes the arrangement undergoes and maintain the external data accordingly (implement before/after_merge_face() in this case). There is

an example in the manual showing how to use an observer for this
purpose.
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/





Archive powered by MHonArc 2.6.16.

Top of Page