Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Problems with removing points from a triangulation,Take 3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Problems with removing points from a triangulation,Take 3


Chronological Thread 
  • From: Nico Kruithof <>
  • To:
  • Subject: Re: [cgal-discuss] Problems with removing points from a triangulation,Take 3
  • Date: Sun, 15 Nov 2009 21:06:34 +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=XE5zwO8R1+QLNrQv7TjmthUulEBYbZXGrCKHpEb0eB6ITOV4PSF6p/P3kpCfevcnfo TlDieOTq6j3mi1LR4Vbf1Kwb5xlZK5lmVneFXA7wS+akSzJ5KQhWirzo6fr5YY8OcqVv sYp+Vu7EM+jPGA0Z6CrCieX+AuiDbZj+jmKOI=

Hi Josip,

When you delete a vertex from the triangulation, you leave a star shaped hole in the triangulation that gets re-triangulated. So, indirectly you do create and destroy cells when you remove the vertex from the triangulation. The code snippet you sent seems fine. Maybe the callstack can help you pinpoint the exact location in your code where the assertion fails.

-- Nico

On Sun, Nov 15, 2009 at 8:56 PM, Josip Dzolonga <> wrote:
Hi Nico,

I thought of that, but at no point I am reusing old cell handles/vertex handles. I thought that while removing them, I might be causing the problem - but even if I change to code to the following, the problems remains

while(!seen.empty()) {

          for(Finite_vertices_iterator vit = T.finite_vertices_begin();
                vit != T.finite_vertices_end(); ++vit) {
                if(seen.find(vit->point()) != seen.end()) {
                    seen.erase(vit->point());
                    T.remove(vit);
                    break;
                }
          }
}

That is, I am iterating again over all vertices.

Thanks,
Josip


On Sun, Nov 15, 2009 at 8:42 PM, Nico Kruithof <> wrote:
Hi Josip,

The assertion says that the vertex is not contained in the Cell. When you remove vertices, cells get removed and added when re-triangulating. Internally, CGAL will reuse the memory of deleted cells for the new cells. This might be the reason you are getting the assertion. 

-- Nico


On Sun, Nov 15, 2009 at 6:26 PM, Josip Dzolonga <> wrote:
Hello everyone,

I am trying to remove some certain points from the Delaunay triangulation. I had some problems even before, and got some advice from here, but the problem still pertains. The problematic code follows

for(Finite_vertices_iterator vit = T.finite_vertices_begin();
            vit != T.finite_vertices_end(); ++vit) {
            if(seen.find(vit->point()) != seen.end()) {
                seen.erase(vit->point());
                T.remove(vit);
           }
}

Where seen is of type std::set<Point> and has been already filled. Later on when I try to use the triangulation, I get the following error

CGAL error: assertion violation!
Expr: v == V[3]
File: /usr/include/CGAL/Triangulation_ds_cell_base_3.h
Line: 98
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Aborted

Which comes from the function  int index(const Vertex_handle& v). I can not remove the same vertex twice, since I am iterating over the finite vertices and this is the only place where vertex removal is taking place. Any ideas would be highly appreciated!

Best,
Josip






Archive powered by MHonArc 2.6.16.

Top of Page