fix a bug in building octree from bottom up.

also add cube-triangle intersections, turns out the code from graphic
gems are not stable...