Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Voronoi diagram implementation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Voronoi diagram implementation


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Voronoi diagram implementation
  • Date: Tue, 05 May 2015 09:00:51 +0200
  • Organization: GeometryFactory

On 04/23/2015 02:32 PM, Malcolm Mielle wrote:
Hello,

I'm new to CGAL so please bear with me.

I'm trying to understand how to compute the Voronoi line of an image I
have. I have read those two user manuals :
http://doc.cgal.org/latest/Segment_Delaunay_graph_2/index.html#Chapter_2D_Segment_Delaunay_Graphs
and
http://doc.cgal.org/latest/Voronoi_diagram_2/index.html#Chapter_2D_Voronoi_Diagram_Adaptor
but some stuff are still very unclear to me.

In the example, the "sites" (which if I understand correctly are the
points and line of my image) are inserted through :

SDG2 sdg;
SDG2::Site_2 site;
while ( ifs >> site ) { sdg.insert( site ); }
ifs.close();

But what is the structure of the sites ? This example assume I have a
file containing site but I don't understand how to create them :s.

A site is either a point or a segment. The stream format is the following:
s x1 y1 x2 y2 # segment define by the points (x1,y1) and (x2,y2)
p x3 y3 # point (x3,y3)
....



Also, if I want to obtain the voronoi line as a graph of points, am I
better using the Adaptor or the Segment Delaunay Graphs ? The difference
between the two is still unclear to me.


?
I guess you want to get the voronoi diagram bisectors of a set of
segments approximated by a set of points.
In that case the easiest way is to use the draw_dual method [1]

A possible implementation of Stream is:
struct Toto{
std::list<Ray_2> ray_list;
std::list<Line_2> line_list;
std::list<Segment_2> seg_list;

void operator<<(const Ray_2& p){ray_list.push_back(p);}
void operator<<(const Line_2& p){line_list.push_back(p);}
void operator<<(const Segment_2& p){seg_list.push_back(p);}
};

Sebastien.

[1] http://doc.cgal.org/latest/Segment_Delaunay_graph_2/classCGAL_1_1Segment__Delaunay__graph__2.html#a140bb7cf97051f7de78de0e0778ff3ea

Thanks a lot.

Best,

--
Malcolm Mielle
Ingénieur Robotique Polytech Paris UPMC
mail :


<mailto:>
Tel : +33(0)782829386



  • Re: [cgal-discuss] Voronoi diagram implementation, Sebastien Loriot (GeometryFactory), 05/05/2015

Archive powered by MHonArc 2.6.18.

Top of Page