Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Voronoi diagrams

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Voronoi diagrams


Chronological Thread 
  • From: Brian Sanjeewa Rupasinghe <>
  • To:
  • Subject: Re: [cgal-discuss] Voronoi diagrams
  • Date: Sun, 22 May 2011 13:33:32 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=SO2E/B7FQGkWjnKS3242xVGMSnOOZ5aiQrnDLeR64R4VAu5q97QUtFdSVKDrWS1AB/ FPFC4srbtRlNgjFQcEsQOVHLJdu2cAjzb97BELR9O8Rh9AlgSK77cGsqzmbrr/g/ysaD dvs46Uni9K6bF5Iy0xh3yKeqG91YC8RpyucqQ=

Dear Sir,

This is the code i have used to create Delaunay triangulation and then to print
number of vertices and faces. Now i need to retrieve coordinates of each vertex
using an index. Please let me know how it can be done?  I followed up tutorial in following link.
http://www.cgal.org/Manual/3.4/doc_html/cgal_manual/Triangulation_2/Chapter_main.html#Section_29.11
But could not get how to do it.

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K>  Gt;
typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;
typedef K::Point_3   Point;

int _tmain()
{
//std::ifstream in("data/terrain.cin");
std::ifstream in("data/test.cin");
std::istream_iterator<Point> begin(in);
std::istream_iterator<Point> end;
Delaunay dt;
dt.insert(begin, end);
std::cout << dt.number_of_vertices() << std::endl;
std::cout << dt.number_of_faces() << std::endl;
std::cout << dt;

return 0;
}

Best regards,
Brian.
On Tue, May 17, 2011 at 4:26 PM, Sebastien Loriot (GeometryFactory) <sloriot.ml@gmail.com> wrote:
Brian Sanjeewa Rupasinghe wrote:
Hi,

Suppose i have a list of ten points in a text file.
I want to create a voronoi diagram of these
points. How van i do it? I am new to CGAL
and please help. I use MS Visual C++ for
programming. I can read the point coordinates
from the file.

Brian.

You can use the Delaunay_triangulation_2 demo.

Sources in the CGAL tarball are here CGAL-3.8/demo/Triangulation_2.
In addition, on windows a precompiled demo is available here:
http://www.cgal.org/demo/3.8/delaunay_triangulation_2.zip

The format for input points is
x1 y1
x2 y2
x3 y3
....
xn yn

S.


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





Archive powered by MHonArc 2.6.16.

Top of Page