Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Segmentation fault when removing vertices from a Delaunay triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Segmentation fault when removing vertices from a Delaunay triangulation


Chronological Thread 
  • From: Josip Dzolonga <>
  • To:
  • Subject: Re: [cgal-discuss] Segmentation fault when removing vertices from a Delaunay triangulation
  • Date: Fri, 6 Nov 2009 16:32:59 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=K7ZAt1pV0TDvL1swwz0l7UfAKhgznamS+rnD9ufB7WU4rvT5k+7kYwJJrJ21oMFl3i Va07zvx0kr1Z3fWMmakEwAs/3lFRqVPP8KIMnyxnE5xbCvOss7jvL+6Q8qlXtMhUovXW be6MI+gBI1gl1ahi96K4c9qBKAi9p2oB2W0Qk=

It might be that the answer is obvious, but since I have very limited experience with CGAL I can not see a direct way of doing this. The following does not work by the same reasons I suspect

std::list<Vertex_handle> toRemove;
for(std::list<Facet>::iterator iter = grown->facets->begin();
      iter != grown->facets->end(); ++iter) {     
    Cell_handle c = (*iter).first;
int index = (*iter).second;
toRemove.push_back(c->vertex((index+1)%4));
toRemove.push_back(c->vertex((index+2)%4));
toRemove.push_back(c->vertex((index+3)%4));
}

T.remove(toRemove.begin(), toRemove.end());

Thanks,
Josip

On Fri, Nov 6, 2009 at 4:21 PM, Sylvain Pion <> wrote:
Josip Dzolonga wrote:
Here is the problematic code:

for(std::list<Facet>::iterator iter = grown->facets->begin();
     iter != grown->facets->end(); ++iter) {
   Cell_handle c = (*iter).first;

int index = (*iter).second;
T.remove(c->vertex((index+1)%4));
T.remove(c->vertex((index+2)%4));
T.remove(c->vertex((index+3)%4));
}

Basically, I have a set of facets that I have extracted from the triangulation and I want to remove them along with their points. But, the T.remove lines cause segmentation faults, where T is of type CGAL::Triangulation_hierarchy_3<Dt>. I get no precondition errors, just a segfault.

When you remove() the first vertex, then the Cell c becomes invalid.
Then, everything can happen.  You need to memorize the Vertex_handles
first, and then remove them without refering to Cells or Facets that
may become invalid.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss





Archive powered by MHonArc 2.6.16.

Top of Page