public BinarySpacePartitionAccelerator(List<RenderItem> items, int maxdepth, int maxsize = 6)
 {
     BoundingBox bb = new BoundingBox();
     Utils.CalculateBoundingBox(items, bb);
     double totalSurface = items.Sum(ri => ri.Surface());
     root = Subdivide(maxdepth, maxsize, bb, 0x00, items, totalSurface);
     bb.OutParam(out x0, out x1, out y0, out y1, out z0, out z1);
     this.box = new double[]{x0,x1,y0,y1,z0,z1};
 }
 public BinarySpaceNode(BinarySpaceNode left, BinarySpaceNode right, double x, int dim)
 {
     this.tri = null;
     this.children = new BinarySpaceNode[0x02] {left,right};
     this.x = x;
     this.dim = dim;
 }