python_prtree icon indicating copy to clipboard operation
python_prtree copied to clipboard

Consider a “query_pairs” method

Open matsupin opened this issue 8 months ago • 1 comments

Hi,

Really interesting tool that you have there, thank you for making it available!

I wonder if it would be possible to introduce a query_pairs type method in a future version, like the one provided by cKDTree in the scipy.spatial module. Ideally, it would return a numpy array of index pairs.

This could prove particularly useful for quickly accessing colliding pairs of AABBs without having to perform any further manipulation in Python.

Currently, to do this I need to use np.vectorize, np.repeat and np.concatenate to convert the nested lists from batch_query into flat arrays and then apply a boolean mask to remove duplicate and undesired pairs. Unfortunately, this whole process cancels out any performance gains from the parallelized C++ calculations.

Please, let me know!

matsupin avatar Feb 03 '25 09:02 matsupin