Original Post
Ok, I need to detect all instances within a varying proximity. Currently, I'm storing the instances in a quadtree. So, for example, say I need to make lists of all instances within 50, 100, 200 and 400 meters of an instance. What would be the most efficient way to query the quadtree for this information? The nodes of the quadtree have a list of the items they contain. I plan on returning a list of the leaf nodes in which the rectangle is bound. From that I can build a list of the instances. Now, the problem is that the query to get all these leaf nodes could be relatively slow, especially when the rectangle is very large in comparison to the entire tree. So, I think I should store all the leaf nodes in such a way that I can easily determine which nodes the rectangle is bound. It seems like a good way to do this would be with another quadtree. But that seems somewhat ironic. Does anyone have any advice?