determination of end points and length of a straight line