Distance between point and a line passing through other two points
I have 3 points with coordinates (x0,y0,z0), (x1,y1,z1) and (x2,y2,z2).
I also have a line joining points (x1,y1,z1) and (x2,y2,z2).
p0=[5.0, 5.0, 5.0]
p1=[3.0, 3.0, 3.0]
p2=[4.0, 4.0, 4.0]
a = np.array(p0)
b = np.array(p1)
c = np.array(p2)
I want to write a script that can calculate shortest distance d between
point (x0,y0,z0) and the line((x1,y1,z1), (x2,y2,z2)).
In other words,
d = distance(a, line(b,c))
Since I have information of the coordinates of these points only, I am not
sure how to put it into python script to get distance d.
On searching Internet, some solutions are discussed for 2D coordinates
(i.e. for (x0,y0), (x1,y1) and (x2,y2) ).
However, I need solution for 3D coordinates.
Any direction or suggestion would be great help.
Thanking you in advance,