Shortest distance between a point and a line segment https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment