Find N nearest neighbours

Paul Harris paulharris at computer.org
Tue Nov 23 13:00:42 UTC 2010


Hi Felix,

You are right, I checked and its not in the git.
And, I had only partially implemented the solution in my code.

So, I wrote HALF a test example, maybe someone (you?) could help out by:
* adding some code to test that it actually works
* generalising it so it can be added into kdtree.hpp, rather than stuck in
an example

the generalisation would mean adjusting the code so it tests using kdtree's
distance calculator, templating it, and adding some methods so users can
just call find_nearest_k() or whatever rather than having to use
find_nearest_if()

I've put it in a branch (branched off master):
http://git.debian.org/?p=libkdtree/libkdtree.git;a=shortlog;h=refs/heads/paulharris/find_nth

look here, under examples, test_kdtree_nth.cpp (click blob or raw)
http://git.debian.org/?p=libkdtree/libkdtree.git;a=tree;h=refs/heads/paulharris/find_nth;hb=refs/heads/paulharris/find_nth


I'm sorry the code isn't finished, I suppose thats why I didn't commit my
previous half-done attempt.
I added a lot of comments to explain the theory behind the predicate, I
believe it should work fine.

Best Regards,
Paul



On 23 November 2010 17:11, <mailinglist at kroegerissendorf.de> wrote:

> Hi,
> I searched for the file in the git repository (
> http://git.debian.org/?p=libkdtree/libkdtree.git;a=summary), but didn't
> find the file test_kdtree_nth.cpp. There were only 3 .cpp files. Could you
> send that file to me by mail, please?
>
> Felix Kroeger
>
>
>
> Quoting Paul <elegant_dice at yahoo.com>:
>
>  Hi Mr Mailinglist, is this a real email address?
>>
>> Look in the examples folder, there is a test_kdtree_nth.cpp file, that
>> should give you a head start.
>> If you can't find the file, check the git repository.
>>
>> thanks
>> Paul
>>
>>
>> On 11 November 2010 17:24, <mailinglist at kroegerissendorf.de> wrote:
>>
>>  Hi,
>>> is there a way to find more than the nearest neighbour of a node in
>>> kdtree?
>>> I would like to find N neighbours (e.g. 5), which are the nearest
>>> neighbours to a given point.
>>> Can anyone help me?
>>>
>>> _______________________________________________
>>> libkdtree-devel mailing list
>>> libkdtree-devel at lists.alioth.debian.org
>>> http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel
>>>
>>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20101123/e833bc1e/attachment.htm>


More information about the libkdtree-devel mailing list