Find a point that is closest to the path (open or closed).
The reference point C
The points of the path P, which must not be empty
If true, the edge from the last to the first point of the path is tested
The closest point to C on the path P
https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Line_defined_by_two_points
Find a point that is closest to the path (open or closed).