Added minimum distance calculations for bounding boxes.