line.closestPoint(p)

Return the closest point laying on the line to the point p.