add method max_dist2_between_boxes