Giter VIP home page Giter VIP logo

pydelaunay's Introduction

PyDelaunay

The set of all points closest to a given point in a point set than to all other points in the set is an interesting spatial structure called a Voronoi Polygon for the point. The union of all the Voronoi polygons for a point set is called Voronoi Tessellation.

Many applications have been found based on the neighbourhood information provided by this tessellation. The dual of Voronoi tessellation is Delaunay Tessellation, also referred to as Delaunay Triangulation or Triangulated Irregular Network (TIN), which are lines drawn between points where their Voronoi polygons have an edge in common.

Delaunay tessellation is the most fundamental neighbourhood structure because many other important neighbourhood structures, such as, Gabriel Graph, Relative Neighbourhood Graph and Minimal Spanning Tree, can be derived from it.

PyDelaunay is a Python implementation of an incremental algorithm, for the construction of Delaunay Tessellation. The algorithm is based on the work of [Guibas & Stolfi 85]. The main algorithm is presented in TinAlgo.py. We have supplied a convenience TinBuild.py to run the algorithm easily via the commandline input.

python TinBuild.py --help will show the usage.

TinBuild - compute Voronoi diagram or Delaunay triangulation

TinBuild [-t -v -p -d]  [filename]

TinBuild reads from filename (or standard input if no filename given) for a set
of points in the plane and writes either the Voronoi diagram or the Delaunay
triangulation to the standard output.  Each input line should consist of two
real numbers, separated by white space.

If option -t is present, the Delaunay triangulation is produced.
Each output line is a triple i j k, which are the indices of the three points
in a Delaunay triangle. Points are numbered starting at 0.

If option -v is present, the Voronoi diagram is produced.

Other options include:

d    Output textually
p    Plot graphically

You can execute TinBuild.py, plotting both Voronoi and Delaunay tessellation interactively with the following commandline and options.

python TinBuild.py -v -t -p test.pts

Vorontoi/Delaunay Tessellation Plot Output

Another test program is TinAlgoTest.py. It generates 100 random points to construct both Voronoi and Delaunay tessellation. Then, it plots the output to the matplotlib window.

  • Note: TinAlgo.py only requires the standard Python library. However, if you want to use the plotting function provided by TinAlgoTest.py or TinBuild.py, NumPy and mathplotlib modules are needed.

References

  • [Guibas & Stolfi 85] Leonidas Guibas and Jorge Stolfi, Primitives for the Manipulation of General Subdivisions and the Computation of Voronoi Diagrams, ACM Trans. on Graphics, Vol 4. no.2, April 1985, pp 75-123.

pydelaunay's People

Contributors

bennycheung avatar

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.