This file is based on the Curve Intersect function by Duane Hanselman. It extends the scope of the function to handle arbitrary lines / polygons, which may also have vertical segments or segments with non-increasing x-values.
Calculate the intersection points of two 2D-lines / polygons.
[X,Y]=CURVEINTERSECT(H1,H2) or [X,Y]=CURVEINTERSECT([H1 H2]) or
-> (H1,H2) handles to line objects
-> (Xi,Yi) coordinates of lines
-> (X,Y) coordinates of intersection
x1=rand(10,1); y1=rand(10,1); x2=rand(10,1); y2=rand(10,1);
Sebastian Hölz (2020). Curve Intersect 2 (https://www.mathworks.com/matlabcentral/fileexchange/8908-curve-intersect-2), MATLAB Central File Exchange. Retrieved .
i need your Help please,
i am still a beginner in Matlab i had a task to determine intersections of polygons and curves, i tried to write a code with the Polyxpoly function, i got the intersections points but i need now to define , a function that calculates the two points that surround the intersection point
if you have any idea tell me please ,
tnahks o lot
why does this result in an empty matrix? curveintersect([-1 -0.9],[0 3],[-0.9 0],[3 0])
I am looking for the intersection of dynamic waves and base line. SO far, I could manage to get few of the intersection points using ratio (Y data of dynamic wave/ Y data of base line) for whole of samples. Pls advise me how should I continue since I was stuck in here so long.
I used your function but mine is dynamic wave form and base straing line so the X -axis is not constant line. So the array is only (1900x1) for wave form and base line. The Y values of wave form is changing but the base line is seems like constant. Let say, there is 64 intersection points visuality but what i can get is only 47 but some are not accutare positions.
Thanks and best regards
Forgot to say thanks and congrats!
Worked great for me, though my application was quite simple.
Extremly good code ! Thx sharing it !!!
One of our students came up with the usage of curveintersect and afaics it works correctly. However the profiler tells me now, that from 300s program runtime 120s are spend in curveintersect and most of the time in the calls to interp1 in curveintersect_l.
Are they really neccessary?
works great! thanks
Great job !!
It is an excelent job, however I found a bug. The function finds wrong intersection, if one of the curves is almost vertical. Please try this:
Excellent job!! Thanks!
Wonderful program. Worked for some very sticky intensity plots where the points of intersection had been hard to find. Vielen dank Sebastian !!!!
Yes, Obviously it is very fast to find intersection point between curves
I'm using this to quickly find the point at which two EXIT functions intersect, its perfect thanks mate.
Overcomes limitations of the D. Hanselman version. THANKS!
Could we use it for a higher dimension?
Works well for me
great command, thank you!
Are you planning to include the case of infinite line intersection?
x1=[0 1]; y1=[0 0];x2=[0.5 0.5]; y2=[0.1 1];
will "intersect" at [0.5,0]
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!