Finding an endpoint of a line segment given the other endpoint and the midpoint