URGENT: Find pth nearest neighbour
paulharris at computer.org
Wed Apr 23 03:49:32 UTC 2008
You could probably do it right now via find_nearest_if() and a predicate...
off the top of my head:
the predicate could be a struct with a state variable (ie pimpl pattern so
it can be copied around, and keeps the data in a pointer)... it will be
called with a node each time it gets closer and closer to the nearest node.
the predicate could do a distance comparison each time, and store the best
two nodes that it sees. then it can return TRUE each time the node is
CLOSER than the SECOND node (the second-closest point), and return FALSE
each time the node is FURTHER than the second node.
i think that would work, you want a fast response so there is a possibly
On 23/04/2008, Ali - <saveez at hotmail.com> wrote:
> It seems someone asked about this feature in October last year which,
> unfortunately, has not been implemented yet. It was suggested that adding a
> new _M_find() with some modifications could be a quick way of doing this, it
> is not clear to me how this may be done.
> Currently I am only interested in the 1st and 2nd nearest neighbours, I
> wonder if a developer could provide a working example for this. This is
> urgent, a less-than-12-hours remedy is well appreciated.
> Moreover, is there any examples around for the new find() framework?
> Be a superhero and win! Play the Iron Man Mashup Game
> libkdtree-devel mailing list
> libkdtree-devel at lists.alioth.debian.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libkdtree-devel