--- a/src/octree.cc Tue Dec 18 12:36:01 2007 +0100
+++ b/src/octree.cc Sat Dec 29 13:53:33 2007 +0100
@@ -17,9 +17,6 @@
void OctreeNode::subdivide(BBox bbox, int maxdepth)
{
- if (maxdepth <= 0 || shapes->size() <= 4)
- return;
-
// make children
children = new OctreeNode[8];
@@ -69,7 +66,8 @@
// recursive subdivision
for (int i = 0; i < 8; i++)
- children[i].subdivide(childbb[i], maxdepth-1);
+ if (maxdepth > 1 && getChild(i)->shapes->size() > 4)
+ children[i].subdivide(childbb[i], maxdepth-1);
}
void Octree::build()