Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
3 Problems with intersections function - "Fast & Robust Curve Intersections"

Subject: 3 Problems with intersections function - "Fast & Robust Curve Intersections"

From: curoch

Date: 14 Jul, 2011 22:40:31

Message: 1 of 1

Dear all,

I am having problems with the intersections function published by Douglas Schwarz. It may be viewed here: http://www.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections

I have 2 problems.

Problem 1: The function works correctly between any two curves. Furthermore, it works correctly for x-amounts of curves if coded in a loop. My problem is that I'd like to perform the operation for any amounts of curves without a loop but so far have not been able to.

The syntax is [xo,yo] = intersections(x1,y1,x2,y2)
Where xo and yo represent the coordinates of the intersection points and (x1,y1) & (x2,y2) represent the coordinates of the curves

I have around 600 lines described by (x1,y1) and one complex curve (x2,y2). As stated, I would like to find all the intersection points between all 600 versions of (x1,y1) with (x2,y2) without using a loop.

Problem 2: The curve described b (x2,y2) is quite complex. Therefore, the amount of intersection points between each version of (x1,y1) and (x2,y2) varies from 2 to around 8 (but I cannot be sure). Is there a way using no loops to store all intersection points even tho they vary for each version of (x1,y1)?

Problem 3 (and the last): Having calculated all intersection points between all curves, I need to compare the distances of each intersection points with a set point and retain only the two intersection points which lie closest to this set point. How many I do this given the fact that I do not know how many intersection points exist for each pair of curves?

Thank you so much for anyone willing to help me,

I will be forever in the debt to whoever can solve (or at least help) my problems.

F

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us