Distance of a Point to a Polygon

This Demonstration shows the numerical distance from a point to a polygon, namely the smallest distance from the point to any of the points of the sides of the polygon. You can drag the red disks to adjust the polygon or the point. The distance is the length of the blue segment in case the "line" option is chosen (normalized at the start to unity as shown). In the case of the "circle" option, the distance is the radius of the smallest circle centered at the chosen point and tangent to the polygon.