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: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] Segmentation fault when removing vertices from a Delaunay triangulation
  • Date: Fri, 06 Nov 2009 16:21:40 +0100
  • Organization: INRIA

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/



Archive powered by MHonArc 2.6.16.

Top of Page