private Box getDominantBox()
    {
        Box best = null;
        int bestDim = 0;

        for (Box b : boxes)
        {
            int dim = b.dominantDimension();
            if ((dim > bestDim || best == null) && b.canSplit())
            {
                bestDim = dim;
                best = b;
            }
        }
        return best;
    }