Line-Line Intersection (N lines, D space)

버전 1.0.0.0 (2.86 KB) 작성자: Serge
Find intersection of N lines in D-dimensional space, in least squares sense.
다운로드 수: 407
업데이트 날짜: 2016/10/29

라이선스 보기

Find intersection of N lines in D-dimensional space, in least squares sense.
X = lineXline(A,B) -line starts & ends as N*D
X = lineXline({x y..}) -lines as D long cell of starts & ends as 2*N
[X,P,R] = lineXline(..) -extra outputs
[X,P,R,x,t,l] = lineXline(..) -plot outputs
X: Intersection point, in least squares sense, as 1*D
P: Nearest point to the intersection on each line, as N*D
R: Distance from intersection to each line, as N*1
x: Intersection point X as D-long cell of coordinates {x y..}
p: Nearest points P as D-long cell of coordinates {x y..} as N*1
l: Initial lines A-to-B as D-long cell of coordinates {x y..} as 2*N

Remarks:
-Lines are assumed to be infinite in both directions.
-Finds point nearest to all lines using minimum sum of squared distances.
-For parallel lines returns an arbitrary point and a warning.
-For lines of length zero returns NaNs.
-Comments/issues/corrections email Serge: s3rg3y@hotmail.com

Example: (3 lines, 2 dimensions)
[X,P,R,x,p,l] = lineXline([0 0;3 0;0 4],[5 5;0 5;5 2]);
plot(x{:},'*k',p{:},'.k',l{:})
X2 = lineXline(l) %alternate input form, same results

Example: (2 lines, 3 dimensions)
[X,P,R,x,p,l] = lineXline(rand(2,3),rand(2,3));
plot3(x{:},'*k',p{:},'.k',l{:})

Example: (4 lines, 5 dimensions)
[X,P,R] = lineXline(rand(4,5),rand(4,5))

인용 양식

Serge (2024). Line-Line Intersection (N lines, D space) (https://www.mathworks.com/matlabcentral/fileexchange/59805-line-line-intersection-n-lines-d-space), MATLAB Central File Exchange. 검색됨 .

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

Community Treasure Hunt

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

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

Minor changes
Minor changes
Minor changes
Minor changes

Changed description
Minor changes
Minor changes
Minor changes
Minor changes
Minor changes
Changed 5th output, minor changes