Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Iterator for the sets in an instance of Union_find

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Iterator for the sets in an instance of Union_find


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Iterator for the sets in an instance of Union_find
  • Date: Thu, 12 Jun 2014 08:17:34 +0200
  • Organization: GeometryFactory

On 06/06/2014 03:46 PM, Michael SCHINDLER wrote:
Dear list,

I am rather new to CGAL, trying to use the weighted Delaunay and
periodic triangulations. At the moment, I have a technical question on
Union_find which I use to identify classes of triangulation vertices.

Once I have unified the sets in my Union_find instance, by
something like
CGAL::Union_find<Vertex_handle> cls;
CGAL::Unique_hash_map<Vertex_handle, typename
CGAL::Union_find<Vertex_handle>::handle> cl_items(NULL);
... and then for some vertex handle vv0, vv1 ...
cls.unify_sets(cls.find(cl_items[vv0]), cls.find(cl_items[vv1]));

I would like to iterate over all sets in cls, which can be done with
the iterator given Union_find::iterator. But how can I then iterate
over the members of such a set?
The only method I know is to filter the iterator range using same_set
or to go over the iterator once and dispatch the element in another
container.


BTW: Is there a more elegant way to use unify_sets without the
search in a Unique_hash_map?
Well, if you extend the vertex type to get an id field (using Triangulation_vertex_base_with_info_3 for example) then you
could use a std::vector to store the handle and get direct
access to the handles.

See some examples here:
http://doc.cgal.org/latest/Triangulation_3/index.html#title13

Sebastien


Thanks in advance for any advice,
Michael Schindler





Archive powered by MHonArc 2.6.18.

Top of Page