上QQ阅读APP看书,第一时间看更新
31. Point-segment distance
Write a program that determines the closest point and shortest distance between a point and a line segment. Let the user left-click twice to define the segment and right-click once to define the point. Draw the segment and point, and a dashed line showing the shortest distance, as shown in the following screenshot: