I think updating `_squared_distance_line` to support the third dimension would be enough.
I think updating
_squared_distance_lineto support the third dimension would be enough.