Skip to Content.
Sympa Menu

cgal-discuss - voronoi of points in an extent

Subject: CGAL users discussion list

List archive

voronoi of points in an extent


Chronological Thread 
  • From:
  • To:
  • Subject: voronoi of points in an extent
  • Date: Sat, 19 Jan 2008 18:03:08 +0100

hi all,
i would like to applicate voronoi with points.

this part works fine by this code :
/////////////////////////////////////////////////////////////////
#include <CGAL/basic.h>

// standard includes
#include <iostream>
#include <fstream>
#include <cassert>

// includes for defining the Voronoi diagram adaptor
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Voronoi_diagram_2.h>
#include <CGAL/Delaunay_triangulation_adaptation_traits_2.h>
#include <CGAL/Delaunay_triangulation_adaptation_policies_2.h>

// typedefs for defining the adaptor
typedef CGAL::Exact_predicates_inexact_constructions_kernel
K;
typedef CGAL::Delaunay_triangulation_2<K>
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;

// typedef for the result type of the point location
typedef AT::Site_2 Site_2;
typedef AT::Point_2 Point_2;

typedef VD::Locate_result Locate_result;
typedef VD::Vertex_handle Vertex_handle;
typedef VD::Face_handle Face_handle;
typedef VD::Halfedge_handle Halfedge_handle;
typedef VD::Ccb_halfedge_circulator Ccb_halfedge_circulator;

void print_endpoint(Halfedge_handle e, bool is_src) {
std::cout << "\t";
if ( is_src ) {
if ( e->has_source() ) std::cout << e->source()->point() << std::endl;
else std::cout << "point at infinity" << std::endl;
} else {
if ( e->has_target() ) std::cout << e->target()->point() << std::endl;
else std::cout << "point at infinity" << std::endl;
}
}

int main()
{

VD vd;
VD::Face_iterator f;

Point_2 *p;

for(int i=0;i<10;i++)
{
p=new Point_2(rand()%200,rand()%200);
vd.insert(*p);
delete p;
p=0;
}

Ccb_halfedge_circulator ec_start,ec;

for(f=vd.faces_begin();f!=vd.faces_end();f++)
{
std::cout << "\n\n";
ec_start = (*f).outer_ccb();
ec = ec_start;
do {
print_endpoint(ec, false);
} while ( ++ec != ec_start );

}

return 0;
}
/////////////////////////////////////////////////////////////////////////

My problem is :
faces in corners has Halfedges with points at infinity.
how can i give an extent to voronoi (for exemple a rectangle), then this
faces can complete their Halfedges with points at infinity with intersection
with the extent?

thank you for your help


  • voronoi of points in an extent, bendaoud_med, 01/19/2008

Archive powered by MHonArc 2.6.16.

Top of Page