Implementation of point quadtree described on Wikipedia