Answer:
where the parameter s is a real number and u=P1-P0 is a line direction vector. Using this representation P(0)=P0, P(1)=P1, and when s.ge-0.le-1, P(s) is a point on the finite segment P0P1 where s is the fraction of P(s)'s distance along the segment. That is, s = d(P0,P(s)) / d(P0,P1). Further, if s < 0 then P(s) is outside the segment on the P0 side, and if s > 1 then P(s) is outside the segment on the P1 side.
Explanation: