Fast points-in-polygon test
by Darren Engwirda
16 Mar 2006
(Updated 03 Dec 2007)
Fast test to determine points located inside general polygon regions. Should be significantly faster
|
Watch this File
|
| File Information |
| Description |
Test a set of points in the 2D plane to determine which are located inside or on the edges of a polygon.
The polygon geometry can be non-convex and multiply-connected.
Similar to INPOLYGON, but generally much faster, more memory efficient and less prone to numerical rounding error.
INPOLY also displays superior scaling in terms of problem size (number of points, number of polygon edges) and hence the speedup when compared to INPOLYGON is significant for large problems and can easily be a factor of several hundred.
% UPDATE 31/03/2007
New algorithm! Massive speed improvements for large problems.
Untested on MATLAB pre-R6.5. These older releases lack JIT acceleration and may suffer speed penalties as a result. |
| Acknowledgements |
This submission has inspired the following:
Maximum Inscribed Circle using Voronoi Diagram, inpoly mex file
|
| MATLAB release |
MATLAB 7 (R14)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (17) |
| 17 Mar 2006 |
Urs (us) Schwarz
|
|
|
| 17 Mar 2006 |
John D'Errico
|
|
|
| 17 Mar 2006 |
Darren Engwirda (The author)
|
|
|
| 19 Mar 2006 |
Urs (us) Schwarz
|
|
|
| 12 Feb 2007 |
Matt K.
|
|
|
| 08 Apr 2007 |
Michael M
|
|
|
| 12 Apr 2007 |
Alex Storer
|
|
|
| 16 Apr 2007 |
Darren Engwirda
|
|
|
| 19 Mar 2008 |
Joseph Marks
|
|
|
| 25 Mar 2008 |
Joseph Marks
|
|
|
| 03 Apr 2008 |
Armin Müller
|
|
|
| 18 Sep 2008 |
Lili Wan
|
|
|
| 07 Nov 2008 |
Dag Lindbo
|
|
|
| 23 Nov 2008 |
Luigi Giaccari
|
|
|
| 05 Jun 2010 |
Bruno Luong
|
|
|
| 26 Oct 2010 |
Sven
|
|
|
| 01 Jul 2011 |
Luke
|
|
|
| Updates |
| 20 Mar 2006 |
Detect points on boundaries |
| 06 Dec 2006 |
Faster |
| 01 Apr 2007 |
New algorithm |
| 02 Apr 2007 |
Error checking added |
| 13 Apr 2007 |
Bug fix (floating point roundoff) |
| 21 May 2007 |
Binary search added, bit faster |
| 03 Dec 2007 |
Floating point error reduced |
|
Contact us at files@mathworks.com