Saturday 15 September 2012

c++ - CGAL Voronoi Diagram: Link input sites to faces -



c++ - CGAL Voronoi Diagram: Link input sites to faces -

i'm constructing voronoi diagram using cgal, so:

//consider points std::vector<point_2> points = read_input(); //throw points (i.e. sites) voronoi diagram vd vd; (std::vector<point_2>::iterator = points.begin(); != points.end(); ++it) { vd.insert(*it); }

now, know if there way retrieve faces original sites belong to:

for (vd::site_iterator = vd.sites_begin(); != vd.sites_end(); ++it) { it->?! }

from signature of iterator above there no apparent link underlying half-edge info construction of voronoi diagram. know locate method, however, far know, locate runs in o(log(n)) time. since want query sites resulting runtime o(n*log(n)), seems kinda wasteful. there i'm missing?

you can other way round iterating on faces , calling dual method.

for (vd::face_iterator fit=vd.faces_begin(), fit_end=vd.faces_end(); fit!=fit_end;++fit) { fit->dual()->point(); }

c++ cgal

No comments:

Post a Comment