nushoin / RTree

N-dimensional RTree implementation in C++
Other
375 stars 107 forks source link

Nearest neighbour search #25

Closed evan-dsa closed 6 months ago

evan-dsa commented 2 years ago

The attached code adds a NNSearch method to the tree that allows users to find the rectangles that are closest to an input rectangle. The distance metric is a euclidean distance. The method is based on a best first search algorithm and therefore should be optimal.

The interface is structure in the same style as the existing Search method. It takes an input rectangle in the same format as Search as well as a callback. The callback has the same syntax as the callback required for the Search method, but takes an additional parameter which is the square euclidean distance.

AlexVonB commented 2 years ago

Thank you very much for your contribution! I just added some reviews above, let me know what you think about it. Best!

evan-dsa commented 2 years ago

Might just be me, but I don't see your review.