Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] about nearest_neighbor_searching

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] about nearest_neighbor_searching


Chronological Thread 
  • From: Bernhard Kornberger <>
  • To:
  • Subject: Re: [cgal-discuss] about nearest_neighbor_searching
  • Date: Thu, 12 Nov 2009 14:29:44 +0100

Flaminigo schrieb:
Hi, I am using CGAL nearest_neighbor_searching to find the nearest neighbor of a given point.
However, the search function only return the coordinates of the nearest point. If i want to mark the original point set for querying. What should I do? I want the search function not only return the coordinates, but also return the id of this point.


I had the same problem several years ago. I don't know if there
is a clean solution in the current version, but my solutions then
were:

a) Using an additional STL-map
b) Add getIndex() / setIndex()-functions to CGAL's Point_2. I did
it like this, but the solution is dirty as the code is then bound
to the modified CGAL code.
c) Meantime I use http://github.com/jmhodges/kdtree2, which is
faster and returns the index of the point.

Best
Bernhard




Archive powered by MHonArc 2.6.16.

Top of Page