Function to interpolate a point position on a line