Added method to calculate a bounding box around shapes.