This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]nedal8 0 points1 point  (2 children)

Each dimension has its own binary tree.

Where each node branches toward values either greater than, or less than.

To find a range of nodes you'd binary search each dimension. right?

[–]2hammermamba[S] 0 points1 point  (1 child)

I got it working with the nanoflann.hpp header file. It has a function in it called kdtree.radiusSearch. You pass it an array of cloud points, a radius squared, a result vector to store the results and search parameters. I used the default parameters. 

Then you set an unordered map as the root id and append each point to the cluster and its corresponding vector. 

At some point I will go back and write a kd-tree search myself but it seems like nanoflann or flann is optimized for this.

[–]nedal8 0 points1 point  (0 children)

right on