You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add query_intersections() method for efficient AABB pair detection
Implements a new query_intersections() method that efficiently finds all
pairs of intersecting bounding boxes in the tree, addressing the feature
request in issue #46.
Key features:
- Returns numpy array of shape (n_pairs, 2) with index pairs (i, j) where i < j
- Parallel processing using std::thread for improved performance
- Automatic double-precision refinement when exact coordinates are available
- No duplicate pairs or self-pairs
- Similar to scipy.spatial.cKDTree.query_pairs but for AABBs
This eliminates the need for manual post-processing of batch_query results
using np.vectorize, np.repeat, and np.concatenate, which previously
canceled out the performance gains from C++ parallelization.
Changes:
- cpp/prtree.h: Added query_intersections() method to PRTree class
- cpp/main.cc: Added Python bindings for all dimensions (2D, 3D, 4D)
- tests/test_PRTree.py: Added comprehensive tests including edge cases
- README.md: Updated documentation with usage examples
All tests pass (45 new tests + existing tests).
Resolves#46
0 commit comments