Code covered by the BSD License

Highlights from Fast and Robust Self-Intersections

5.0
5.0 | 6 ratings Rate this file 33 Downloads (last 30 days) File Size: 3.36 KB File ID: #13351 Version: 1.0

Fast and Robust Self-Intersections

Antoni J. Canós (view profile)

11 Dec 2006 (Updated )

Computes the self-intersections of a curve.

File Information
Description

This function computes the locations where a curve self-intersects in a fast and robust way. The curve can be broken with NaNs or have vertical segments. Segments of the curve involved in each of the self-interesections are also provided.

Example of use:
N=201;
th=linspace(-3*pi,4*pi,N);
R=1;
x=R*cos(th)+linspace(0,6,N);
y=R*sin(th)+linspace(0,1,N);
t0=clock;
[x0,y0,segments]=selfintersect(x,y)
etime(clock,t0)
plot(x,y,'b',x0,y0,'.r');
axis ('equal'); grid

Acknowledgements

Fast And Robust Curve Intersections inspired this file.

This file inspired Fgt Fold Geometry Toolbox.

MATLAB release MATLAB 6.5 (R13)
13 Nov 2015 Thayjes Srivas

Thayjes Srivas (view profile)

Hi, I have a questions. Is it possible to use this to reorder a polygon such that all the self intersections are removed but the same points are conserved?

Comment only
19 Feb 2014 Muyun

Muyun (view profile)

Mr. Canos,

It's an awesome program. But could you explain in what way is the following block of code useful, and why does it appear twice?

remove = isnan(sum(dxy1(i,:) + dxy2(j,:),2));
i(remove) = [];
j(remove) = [];

Thank you.

07 Jan 2014 Ilya

Ilya (view profile)

it would be helpful to show how to get the (all) values of "t", at which the intersections occur.

Namely, two values of the parameter "t" correspond to each self-intersection.

06 Jan 2014 Ilya

Ilya (view profile)

it would be helpful to show how to get the (all) values of "t", at which the intersections occur.

06 Aug 2013 David Bazalar

David Bazalar (view profile)

08 Jul 2010 Evgeny Pr

Evgeny Pr (view profile)

14 May 2009 Robert Beardmore

Robert Beardmore (view profile)

It certainly is very good and saved me a lot of bother!!

Comment only
24 Jan 2008 Joseph Marks

This is really great !!!

And I just needed it, too !!!

THANKS VERY MUCH !!!

Sincerely,
Joseph