Return a long double between 0 and 1 representing the location of the closest point on the segment to the given point, as a fraction of total segment length (2D version)