Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting node children #172

Open
grovesNL opened this issue Jun 28, 2024 · 0 comments
Open

Sorting node children #172

grovesNL opened this issue Jun 28, 2024 · 0 comments

Comments

@grovesNL
Copy link
Contributor

I was wondering if we might consider having a way to apply a custom sort function for a node's children (sorted on insert/split/etc.) to help with ordering intersection points later on. Maybe this could be some kind of custom insert strategy or some hook where we could specify how nodes should be ordered?

I'd basically like to find all intersections (e.g., locate_in_envelope_intersecting) and iterate through them in a specific order. Right now I collect all the intersections into a temporary SmallVec/Vec sort that. It would be better if leaf nodes were already partially sorted, so that sort would be faster (e.g., many repeated calls to locate_in_envelope_intersecting would benefit from having sorted children stored on the nodes).

One place this would be useful is when checking for 2D geometry collisions, where it would be beneficial to iterate through the nodes with the largest area first for fine-grained intersection testing. The idea would be that I could test largest nodes first and exit early if there's a collision. The other nodes would still be loaded from the rtree but not tested.

I could also see it being useful to sort by custom priority/depth/elevation/etc. for some other use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant