A Quadtree/Octree/N-ary tree implementation in matlab