The solution you refer to works because it is based on the properties of arks:
- An arc is a part of the circle
- Minimum distance is always reached either at the endpoints or at the perpendicular because it minimizes the distance (objective function). Think of two circles - minimal is always perpendicular to both.
- Perpendicular to the arc always crosses the center of the arc because radius is always perpendicular to the circle
- Perpendicular case is when straight line that connects centers crosses both of arcs when they are convex to each other
- Endpoint case is when the line from the prev. item does not cross both arcs - then minimum of distance is reached on the endpoints closest to the line between the centers.