Skip to Content.
Sympa Menu

cgal-discuss - the geometric information of a vertex...

Subject: CGAL users discussion list

List archive

the geometric information of a vertex...


Chronological Thread 
  • From:
  • To:
  • Subject: the geometric information of a vertex...
  • Date: Sat, 3 Nov 2007 18:46:37 +0100

Hello again,

I noticed there is some problem with the geometric information of a vertex in
some cases. I have managed to isolate the problem to a small code snippet,
but there I really have no idea what is going wrong. It would be great if
someone can have a look. Here are two examples. In the first one the geometry
os OK and can be accessed. In the second case it is corrupted from some point
onwards and the whole thing crashes.

//I have a class, which looks like that:
class Planar_Segment
{
unsigned int _ID;
void set_ID(){_ID = this->_points[0]->info().clusterID();}
public:
vector<Delaunay::Vertex_handle> _points;
Planar_Segment(vector<Delaunay::Vertex_handle> po);
};
Planar_Segment::Planar_Segment(vector<Delaunay::Vertex_handle> po):_points(po)
{this->set_ID();}


//That is the version which has no problem
Planar_Segment create_segments_TDS(Delaunay dt)
{
vector<Delaunay::Vertex_handle>vvh;
for(Delaunay::Vertex_iterator vi = dt.vertices_begin(); vi !=
dt.vertices_end(); vi++)
{
Delaunay::Vertex_handle vh = vi;
vvh.push_back(vh);
}
Planar_Segment ps(vvh);
return ps;
}

Planar_Segment ps = create_segments_TDS(dt);
for(int j=0; j<(ps._points).size(); j++)
{
cout<<(ps._points)[j]->point()<<endl;
}


//That is the one that crashes
vector<Planar_Segment> create_segments_TDS(Delaunay dt)
{
vector<Delaunay::Vertex_handle>vvh;
for(Delaunay::Vertex_iterator vi = dt.vertices_begin(); vi !=
dt.vertices_end(); vi++)
{
Delaunay::Vertex_handle vh = vi;
vvh.push_back(vh);
}
Planar_Segment ps(vvh);
vector<Planar_Segment>vps; vps.push_back(ps);
return vps;
}

vector<Planar_Segment> vps = create_segments_TDS(dt);
Planar_Segment ps = vps[0];
for(int j=0; j<(ps._points).size(); j++)
{
cout<<(ps._points)[j]->point()<<endl;
}



Archive powered by MHonArc 2.6.16.

Top of Page