Search code examples
c++cgal

Getting Vertex_handles to the points of a delaunay triangulation


I want to iterate through all vertices of a CGAL::Delaunay_triangulation_2, but am unable to find documentation about getting all the vertex handles.

The documentation I found for this explained how to iterate through the triangulation.

typedef CGAL::Delaunay_triangulation_2<K> T;
typedef T::Vertex_handle Vh;
typedef T::Vertex_iterator Vi;
for (Vi vi = g.vertices_begin(); vi != g.vertices_end(); vi++) {
    // Vh v = how can I get this?
}

However, I cannot find documentation about how to get to the Vertex_handle from the iterator


Solution

  • Okay I was just stupid. Tried some more random things and got that the iterator actually is the handle. Of course I find this out after writing the whole post here :-)

    typedef CGAL::Delaunay_triangulation_2<K> T; 
    typedef T::Vertex_handle Vh; 
    typedef T::Vertex_iterator Vi; 
    for (Vi vi = g.vertices_begin(); vi != g.vertices_end(); vi++) { 
        Vh v = vi;
    }