DISTANCELINES3D Minimal distance between two 3D lines.
D = distanceLines3d(LINE1, LINE2);
Returns the distance between line LINE1 and the line LINE2, given as:
LINE1 : [x0 y0 z0 dx dy dz] (or M-by-6 array)
LINE2 : [x0 y0 z0 dx dy dz] (or N-by-6 array)
D : (positive) array M-by-N
[D, PT1, PT2] = distanceLines3d(LINE1, LINE2);
Also returns the points located on LINE1 and LINE2 corresponding to the
shortest distance.
One should get the following:
distancePoints3d(PT1, PT2) - D == 0
Example
line1 = [2 3 4 0 1 0];
line2 = [8 8 8 0 0 1];
distanceLines3d(line1, line2)
ans =
6.0000
See also:
lines3d, distancePoints3d
---------
authors: Brandon Baker, oqilipo, David Legland
created January 19, 2011
Package: matgeom