add nearest_in_box_border method