Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Inserting vertices into Voronoi Diagram

Subject: CGAL users discussion list

List archive

[cgal-discuss] Inserting vertices into Voronoi Diagram


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] Inserting vertices into Voronoi Diagram
  • Date: Mon, 23 Nov 2009 12:45:41 +0100 (CET)

Hello,

i started working with CGAL and Voronoi diagrams couple of weeks ago.
I am trying to implement a CGAL version of so called iterativ Voronoi
diagrams.
Basically, vertices if a voronoi diagram are used in the next iteration as
sites for the new diagram.
So, i created a new function which reads all vertices of the current VD in a
vector, clears the VD and inserts the new points using the coordinates of the
vertices saved inside the vector.

This is how the whole function inside the Virtual_voronoi_diagram_2.h
describing the VD looks like:

virtual void get_next_diagram(){

typedef std::vector<Vertex> Vertex_vector;

Vertex_vector vv;
Vertex_iterator vit;
Point_2 p;

for (vit = this->vertices_begin(); vit != this->vertices_end(); ++vit) {
vv.push_back(*vit);
}
this->clear();

for (unsigned int i = 0; i < vv.size(); i++) {
p = Point_2(vv[i].point().x(), vv[i].point().y());
this->insert(p);
}
bool b = this->is_valid();
}

Compilation works perfectly. But the execution of the funtions always crashes
the program with a segmentation fault. I believe Vertex_iterator reads some
vertices from the diagram twice or there is an issue with wrong way i save or
handle them.
The procedure is quite easy, so i wonder if there is a deeper
misunderstanding
of the whole structure.

By the way same segmentation faults happen while basically inserting sites
into
the layer (which should work, because my code does not influence the basic
creation of sites. The segmentation faults even happened in the original
version of the voronoi diagram demo occasionally, but not that often as in my
modified version.)

I hope i explained the problem properly.
Good day.

Artyom



Archive powered by MHonArc 2.6.16.

Top of Page