I'm having quite some difficulty getting a vertex_handle for each of the end points of an edge in a Delaunay triangulation. Since I hammered my head against this for several hours I thought maybe one of you guys could help me out with this apparently trivial problem:
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
using namespace std;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Triangulation;
typedef Triangulation::Point Point;
typedef Triangulation::Edge_iterator Edge_iterator;
typedef Triangulation::Vertex_handle Vertex;
int main(){
Point p;
Triangulation t;
while(cin >> p)
t.insert(p);
// Iterate over edges
for(Edge_iterator ei=t.finite_edges_begin();ei!=t.finite_edges_end(); ei++){
// Get a vertex from the edge
Vertex vs = ei->source();
}
}
According to the documentation dereferencing an Edge_iterator I should get an Edge_handle and Edge_handle should have members source() and target() to simply get the endpoints, but it won't compile and seems to be wrong. Derefencing like above will give me a pair<> which doesn't have those member functions.
Any idea what I'm doing wrong?