Shortest Distance Between Two Lines in N dimensions

버전 1.1.0.0 (1.96 KB) 작성자: Alexander Brodsky
Function calculates shortest distance between two lines presented by two points for each line.
다운로드 수: 2K
업데이트 날짜: 2011/4/1

라이선스 보기

Function uses algorithm from Dan Sunday internet site
http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm#dist3D_Segment_to_Segment
L1, L2 includes two points in matrix of 2*n
where n are dimensions (3 in 3D).
d - shortest distance between two lines
Pc,Qc - points where exists shortest distance d

EXAMPLE:
L1=rand(2,3);
L2=rand(2,3);
[d Pc Qc]=distBW2lines(L1,L2)

Functions of lines L1,L2 and shortest distance line
can be plotted in 3d or with minor change in 2D by
removing comments sign from code at the end of the file.
In some cases points Pc,Qc will not displayed accurately on line.
Just change value of par parameter according to point.

Programmed by Alexander Brodsky
newshurik at yahoo.com

인용 양식

Alexander Brodsky (2024). Shortest Distance Between Two Lines in N dimensions (https://www.mathworks.com/matlabcentral/fileexchange/29130-shortest-distance-between-two-lines-in-n-dimensions), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Construction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

1. Distance value was corrected (thanks to Guy)
2. Dot function was changed by matrix multiplication for speeding the script

1.0.0.0