I guess I never shared this library here. It contains an AABBTree algorithm which is used to do efficient queries on 2D space. It’s useful when doing collisions, view culling (only drawing elements that the camera can see), knowing what your mouse is hovering, etc. It can be dynamically updated as your world objects move around.
I also just added an IntervalTree (1D version of the AABBTree). It’s useful for doing queries on 1 axis, for example in a video editor it could be used for the timeline.
Here is an example app where I use the AABBTree: GitHub - Apostolique/Mitten: Infinite canvas drawing application.