Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Retrieving cgal voronoi diagram connected components

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Retrieving cgal voronoi diagram connected components


Chronological Thread 
  • From: Pol Monsó Purtí <>
  • To:
  • Subject: Re: [cgal-discuss] Retrieving cgal voronoi diagram connected components
  • Date: Tue, 12 Jul 2016 18:00:20 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:U96xBRzdW1ooIOPXCy+O+j09IxM/srCxBDY+r6Qd0eMWIJqq85mqBkHD//Il1AaPBtSDrakUwLKL+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwud7yzQd6Z15n//tvx0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe1XwWR1OQDbxE6ktY/jtKNl6Dla7vI969ZbA+K9ZLU9VbUeDTI8Mmlz6tesrgjGVQLI530SVSIdnRNMRgTE9xrnRYyijiyvveV03GyWPNb9UKsvcTWk9aZiDhHy2wkdMDtsyGbTwul3irnA6Cq8vQD6i9rQZJyTPbx4eb3UVdwfTGtFGM1WUnoSUcuHc4ITAr9Zbq5jpI7nqg5WoA==

I was wrong, I've found the is_bissector() function and my voronoi regions are unbounded. Therefore I do need to constrain it. I'll take a look at the code you added and consider switching to segmented.

On Tue, Jul 12, 2016 at 5:47 PM, Pol Monsó Purtí <> wrote:
Thanks for the link. At first glance I can't seem to find where in the code retrieves the polygons, I'll keep looking. In my case at the moment I don't need the unbounded components so no need to constrain it. 

What I've come up with so far is the following (quite rudimentary):

std::map<VD::Delaunay_vertex_handle, std::vector<Point_2>> vregions;

    for (VD::Halfedge_iterator eit = vd.halfedges_begin(); eit != vd.halfedges_end(); ++eit)
    {
      VD::Halfedge e = *eit;
      if(e.is_valid() && !e.is_unbounded() && e.has_source())
      {
          VD::Delaunay_vertex_handle ssite = e.up();
          if(vregions.count(ssite) == 0)
              vregions[ssite] = std::vector<Point_2>();
          vregions[ssite].push_back(e.source()->point());
        std::cout << std::fixed << "Site " << ssite->point() << ": " << e.source()->point() << std::endl;
      }
    }
int i = 1; for(const auto& vregion : vregions) { //std::cout << "Polygon " << i << std::endl; for(const auto& p : vregion.second) { std::cout << std::fixed << p.x() << " " << p.y() << " " << i << std::endl; } i++; }

But it's wrong, I'm displaying the resulting polygons' vertex on Cloud Compare and they don't match the voronoi.


On Tue, Jul 12, 2016 at 4:31 PM, Sebastien Loriot (GeometryFactory) <> wrote:
Maybe this is doing what you want:
https://github.com/sloriot/cgal-voronoi-cropping

Given a set of points and a bounding box, you get a HDS
containing the Voronoi diagram of your input points
cropped to the bounding box.

See the example:
https://github.com/sloriot/cgal-voronoi-cropping/blob/master/test/main.cpp

HTH,

Sebastien.




On 07/12/2016 04:01 PM, Pol Monsó Purtí wrote:
I'd like to retrieve the polygons made of the voronoi bissectors or, at
least, the bounding box of each voronoi region. That is, extracting the
connected components of a voronoi diagram.

I'm struggling to see which of the iterators is appropriate and wether
the funcionality is already in cgal's voronoi diagram.

Another way of seeing it is retrieving it all the voronoi vertices that
concern each site, with their order for the polygon or without for the
bounding box.

I am not sure which iterator to use or if there's one that already
circulates around the voronoi vertices of a site. I couldn't find it
from the documentation.

The diagram is in 2D.

My definitions:


typedef  CGAL::Exact_predicates_inexact_constructions_kernel  K;

typedef  CGAL::Projection_traits_xy_3<K>   Gt;

[...]
//cgalvoronoi

typedef  CGAL::Delaunay_triangulation_2<Gt>                                    DT;

typedef  CGAL::Delaunay_triangulation_adaptation_traits_2<DT>                  AT;

typedef  CGAL::Delaunay_triangulation_caching_degeneracy_removal_policy_2<DT>  AP;

typedef  CGAL::Voronoi_diagram_2<DT,AT,AP>                                     VD;




--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss







Archive powered by MHonArc 2.6.18.

Top of Page