Which line is the first line that has an intersection with another line? or what is the order of the intersectection points?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have a problem in my code and I have simplified it as below:
x=[12;25;7];
y=[6;31;15];
xd=[5;40;NaN;2;11];
yd=[13;16;NaN;8;9];
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241164/image.png)
I have the above points I want to calculate the intersection, between line 1 and line 2,3. I used polyxpoly.
Here is my question, how can I undesrtand which line is the first iinterseted line while moving from point (x,y)1 to (x,y)2. Is it line 2 or line 3?
Thanks a lot
댓글 수: 0
채택된 답변
darova
2019년 10월 4일
Use third output argument of polyxpoly
[xc,yc,ix] = polyxpoly(x,y,xd,yd)
% ix(:,1) - number of intersected segment in [x,y] data
% ix(:,2) - number of intersected segment in [xd,yd] data
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Live Scripts and Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!