Scilab Function
Last update : 30/10/2005
distance - Minimum distance between to
lines
Calling Sequence
-
[p1,p2,entf] =
distance(a,b,c,d)
Parameters
-
a
: Local Vector Line 1
-
b
: Direction Vector Line 1
-
c
: Local Vector Line 2
-
d
: Direction Vector Line 2
-
p1
: point on line 1 with minimum distance to line 2
-
p2
: point on line 2 with minimum distance to line 1
-
entf
: minimum distance between line 1 and 2
Description
-
This function makes quite simple operations: mtx=[b*b' -b*d';b*d'
-d*d']; vek=[c*b'-a*b';c*d'-a*d']; rs=inv(mtx)*vek; p1=a+b*rs(1,1);
p2=c+d*rs(2,1); difvek=p2-p1; entf=sqrt(difvek*difvek');
Examples
a=[1,1,0]; b=[0.5,2,1];
c=[0,1,2]; d=[2,0.5,3];
[p1,p2,entf]=distance(a,b,c,d);
disp(p1);
disp(p2);
disp(entf);
See Also
ponci
,
ponbowl
,
Authors
-
Dr. Andreas Geissler geisslea@web.de