Which line is the first line that has an intersection with another line? or what is the order of the intersectection points?

1 view (last 30 days)
Zarak kh
Zarak kh on 4 Oct 2019
Answered: darova on 4 Oct 2019
I have a problem in my code and I have simplified it as below:
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

Accepted Answer

darova on 4 Oct 2019
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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!