GithubHelp home page GithubHelp logo

ljuillen / find-poly Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dengwirda/find-poly

0.0 1.0 1.0 1.7 MB

A fast points(s)-in-polygons(s) test for MATLAB.

License: Other

MATLAB 95.25% C++ 4.75%

find-poly's Introduction

FIND-POLY: Fast point(s)-in-polygon(s) queries in MATLAB

A fast "point(s)-in-polygon(s)" routine for MATLAB / OCTAVE.

Given a collection of polygons and a set of query points, FINDPOLY determines the set of enclosing polygons for each point. Arbitrary collections of polygons and query points are supported, and general non-convex and multiply-connected inputs can be handled. FINDPOLY employs various spatial indexing + sorting techniques, and is reasonably fast for large problems.

Given K polygons (each with M edges on average) the task is to find the enclosing polygons for a set of N query points. The (obvious) naive implementation is expensive, leading to O(K*M*N) complexity (based on a simple loop over all polygons, and calling a standard points-in-polygon test for each individually). This code aims to do better:

  • Employing a "fast" inpolygon routine, reducing the complexity of each point(s)-in-polygon test (based on spatial sorting) to approximately O((N+M)*log(N)).

  • Employing a spatial tree (an aabb-tree) to localise each points-in-polygon query within a spatially local "tile". This typically gains another logarithmic factor, so is a big win for large K.

Quickstart

After downloading and unzipping the current repository, navigate to the installation directory within MATLAB / OCTAVE and run the examples in polydemo.m.

For good performance in OCTAVE, the underlying INPOLY kernel can be compiled from C++ as an *.oct file. See documentation on MKOCTFILE for additional information. Typically, MATLAB's in-built JIT-acceleration leads to good performance by default.

License Terms

This program may be freely redistributed under the condition that the copyright notices (including this entire header) are not removed, and no compensation is received through use of the software. Private, research, and institutional use is free. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)

DISCLAIMER: Neither I nor the University of Sydney warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk.

find-poly's People

Contributors

dengwirda avatar

Watchers

James Cloos avatar

Forkers

keassyguang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.