Shortest distance between two line segments (Scripts) Publisher's description
from Nick Gravish
Computes the shortest distance between two line segments given start and end points for each.
Computes the shortest distance between two line segments given start and end points for each. Adapts the algorithm found on Dan Sunday's website (http://softsurfer.com/Archive/algorithm_01...ment_to_Segment
Usage: Input the start and end x,y,z coordinates for two line segments.
p1, p2 are [x,y,z] coordinates of first line segment and p3,p4 are for
second line segment.
Output: scalar minimum distance between the two segments.
P1 = [0 0 0]; P2 = [1 0 0];
P3 = [0 1 0]; P4 = [1 1 0];
dist = DistBetween2Segment(P1, P2, P3, P4)
System Requirements:MATLAB 7.10 (2010a)
Program Release Status: New Release
Program Install Support: Install and Uninstall