Supposing the equation of the line is p1 + t*d1, returns the t representing the closest point
The point
The starting point of the line
The direction of the line