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: Flaminigo <>
  • To:
  • Subject: Re: [cgal-discuss] about nearest_neighbor_searching
  • Date: Fri, 13 Nov 2009 20:17:21 +0800
  • 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=voAtVWAHKmkkKy2EE8AaEf8jkVhk+4QwF5UVTvikQVskOVXtCj0KclomFigV1+BcpU J6gbnrKjN9Xt09v/96TJe0vCXsj4o+MXzhJBWMu4uyKNNRvGBdCSDSCvj1QhdqNHK+Pc PjZzc9xv5Hwdp/x0H/7R8uWBDn1ryyAJa3hpQ=

Thank you very much. I've tried to inherit the class Point_2/3 to add an extra member variable 'index'. However, when building the searching tree, the internal of the tree still uses the parent class Point_2/3 instead of my inherited one. But your advice is applicable, I think. Modifying the source code is acceptable. Maybe we can provide a patch called CGAL-EX to implement functions like this. :)

Regards
XU

On Thu, Nov 12, 2009 at 9:29 PM, Bernhard Kornberger <> wrote:
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



--
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