Implementing octree traversal