diff -r 76b7bd51d64a -r 7e258561a690 src/kdtree.cc --- a/src/kdtree.cc Mon Dec 03 01:49:23 2007 +0100 +++ b/src/kdtree.cc Tue Dec 04 08:58:05 2007 +0100 @@ -186,7 +186,6 @@ const Float K = 1.4; // constant, K = cost of traversal / cost of ray-triangle intersection Float SAV = 2*(bbox.w()*bbox.h() + bbox.w()*bbox.d() + bbox.h()*bbox.d()); // surface area of node Float cost = SAV * (K + shapes->size()); // initial cost = non-split cost - SplitPos *splitpos = NULL; bool leaf = true; BBox lbb = bbox; BBox rbb = bbox; @@ -203,7 +202,7 @@ { leaf = false; cost = splitcost; - splitpos = &*spl; + split = spl->pos; } } @@ -236,10 +235,6 @@ f += 4; #endif - split = splitpos->pos; - Float lnum = splitpos->lnum; - Float rnum = splitpos->rnum; - // split this node delete shapes; children = new KdNode[2]; @@ -279,13 +274,13 @@ if (split - bbox.L.cell[axis] < bbox.H.cell[axis] - split) { // left subcell is smaller -> if not empty, put shape here - if (lnum) + if (children[0].shapes->size()) children[0].addShape(sh->shape); else children[1].addShape(sh->shape); } else { // right subcell is smaller - if (rnum) + if (children[1].shapes->size()) children[1].addShape(sh->shape); else children[0].addShape(sh->shape);