Calculate distance from a point to a line