THST icon indicating copy to clipboard operation
THST copied to clipboard

QuadTree min/max?

Open marcakafoddex opened this issue 1 year ago • 3 comments

I don't really understand the min/max constructor parameters for QuadTree. Does it indicate the maximum boundaries for any bbox inserted into the tree? The RTree has no such parameters.

marcakafoddex avatar Jun 09 '24 15:06 marcakafoddex

Compared to the RTree which computes the bounding box dynamically, the QuadTree needs a world bounding box that will be used for subdivision (so that it can create the nodes).

tuxalin avatar Jun 10 '24 11:06 tuxalin

Cool, thanks for answering so quickly! A few follow up questions:

  • What happens if a bbox is added to the tree that falls outside of the initiql min/max passed to the constructor?
  • Does it make sense to pass -std:: numeric_limits<float>::max() - std:: numeric_limits<float>::max() as a catch-all construction?

marcakafoddex avatar Jun 10 '24 11:06 marcakafoddex

  1. It will asset and not add the item.
  2. No, in that case it makes you'll have many empty nodes and a high tree depth, which will result in very slow queries, in those cases it's best to split the world into a box grid with multiple quad/rtrees and do a neighbor search.

tuxalin avatar Jun 12 '24 10:06 tuxalin