View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Fast and Robust Self-Intersections

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0
5.0 | 7 ratings Rate this file 19 Downloads (last 30 days) File Size: 3.36 KB File ID: #13351 Version: 1.0
image thumbnail

Fast and Robust Self-Intersections

by

 

11 Dec 2006 (Updated )

Computes the self-intersections of a curve.

| Watch this File

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)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
13 Apr 2016 nasrin

nasrin (view profile)

 
13 Nov 2015 Thayjes Srivas

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  
08 Jul 2010 Evgeny Pr

Evgeny Pr (view profile)

 
14 May 2009 Robert Beardmore

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

Contact us