CSharp QuadTree Implementation


Here is my QuadTree implementation in C#. After looking for a complete, working example, and finding none, I made my own. And now I'm sharing it with my fellow lazy developers!

Its a generic implementation, however objects added must implement the IQuadObject interface - its used to notify the QuadTree that the objects boundary has changed (yes, thats right, it will remap itself based on changes to the underlying boundaries).

It has an overloaded constructor, allowing you to specify whether or not you want query results returned sorted in the order in which they were added. The methods are locked, so it can handle multithreaded access (I have multiple threads hitting it in my app).

Anyway, I'm sure the code is self explanatory, good luck :)

Last edited Jul 9, 2009 at 8:13 PM by ecassidy, version 2