Here's an implementation of a Quadtree in C#:
main.cs2982 chars114 lines
You can use the Insert
method to add objects to the quadtree and the Query
method to retrieve a list of objects that intersect with a given bounds.
Note that you'll need to replace the GetBounds
method with your own logic for getting the bounds of an object.
Here's an example usage:
main.cs565 chars16 lines
gistlibby LogSnag