RTree Point3dKNeighbors help

Hi @arendvw

I noticed that the the results are different, so I looked into trying to understand what was going on. Sorry I don’t have time to debug this. There’s something to fix, as simple cases do not work. I also tried inverting the C and P inputs, but results are even more wrong.


test-kd-trees-arend.gh (10.1 KB)


Definitely not needed! The code is structured so that’s not needed, but it’s possible to inadvertently make it work that way.

Regarding your pictures, @rawitscher-torres, there is an additional detail to consider. For making a good comparison, you need to pass the data structures in the same way (if you search many small buckets with many small buckets, it’s not the same as searching a big haystack of points for a big amounts of needles).

@arendvw - Thanks for sharing the code. Very useful. I am having a similar issue with Rhinocommon’s Rtree and would like to use the Accord.net implementation.
Is there a way to get the index of the original point instead of the actual position in space?

var pts = neighbours.Select(n =>
                {
                    var pos = n.Node.Position;
                    return new GH_Point(new Point3d(pos[0], pos[1], pos[2]));
                });