I'm not even sure if the older algorithm computed the correct result.

In any case it was numerically very unstable for 2 reasons:

computing the square and then subtracting the results.

In the example in T60935 all precision was lost and it returned the distance 0

for all points.

It might make sense to remove the other algorithm since it is not used anywere.

Also maybe some code can be shared with the `dist_squared_to_line_XXX`

functions.

I also removed the `depth` parameter since it wasn't used and computing

it would have made the code more complicated.