Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Type of dD Triangulation Finite iterators?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Type of dD Triangulation Finite iterators?


Chronological Thread 
  • From: Marc Glisse <>
  • To: Marc Alexa <>
  • Subject: Re: [cgal-discuss] Type of dD Triangulation Finite iterators?
  • Date: Thu, 28 May 2020 10:15:35 +0200 (CEST)

On Thu, 28 May 2020, Marc Alexa wrote:

Thanks! I’d say it’s still a little confusing that one casts to the element
handles and the other doesn’t. Plus for 3D triangulations it works the same
for both iterators.

I needed it because rather than extending the base classes for attaching
information I like to create a hash map to int and than use the indices, like
so:

int nv = 0;
CGAL::Unique_hash_map<T::Vertex_handle, int> VH;
T::Finite_vertex_iterator vit=t.finite_vertices_begin();
for (; vit != t.finite_vertices_end(); ++vit)
VH[vit] = nv++; // error here: no known conversion

You could use unordered_map<T::Vertex*, int> and VH[&*vit] (or operator->) which then works both for finite and regular iterators but that's not super convenient either.

This works for the non-finite iterators. Which, frankly, took me some time to
figure out. I believe this construction can also be found in the CGAL source
code, at least for 3D triangulations.

You could file an issue on github asking to document how to get a handle from a finite iterator and/or provide a conversion operator. It isn't hard, but I cannot promise than anyone will get to it anytime soon.

--
Marc Glisse



Archive powered by MHonArc 2.6.19+.

Top of Page