This procedure shows us how best to partition some subset of objects into two more cells as we are preprocessing our geometry for ray-tracing. However, it is not explicitly stated when this procedure ends-i.e. when we choose to throw all of the objects into a leaf node. I think that in addition to calculating the costs of all the partitions, we need to also compare these costs against the expected cost if we decided to put all of these triangles into a leaf node. This would then give us a stopping point for our procedure so that we don't infinitely recurse. I am not sure if this is the best way to do it though, maybe there is an additional heuristic that we can use to determine when it is best to make a leaf node?