So, I need to calculate the distance from a point in 3d space to a line(segment) in 3d space. I know how to calculate the distance between a point and a line(segment) in 2d. And I also know how to determine the distance between two points in 3d. Now my attempt is :
- project the line and the point in 2d : front view, side view, top view
- determine the distances in the 2d projections
- create a point out of the distances p=(distance front view, distance side view, distance top view)
- determine the distance from this point p to to the point q=0,0,0
Is this correct ?
Thanks for your help.
hint
Assume your line is defined by parametric equations $$x=a+ut $$ $$y=b+vt $$ $$z=c+wt $$
to calculate the distance from the point $(x_0,y_0,z_0) $ to the line, it is equivalent to find the minimum of
$$(x_0-a-ut)^2+(y_0-b-vt)^2+(z_0-c-wt)^2$$
the value of $t $ which minimize this square, gives the desired distance.