All Projects → jmespadero → pyDelaunay2D

jmespadero / pyDelaunay2D

Licence: GPL-3.0 license
A simple Delaunay 2D triangulation in python (with numpy)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyDelaunay2D

delaunay-triangulation-algorithm
Delaunay Triangulation
Stars: ✭ 25 (-82.76%)
Mutual labels:  voronoi-diagram, delaunay-triangulation
tektosyne
The Tektosyne Library for Java provides algorithms for computational geometry and graph-based pathfinding, along with supporting mathematical utilities and specialized collections.
Stars: ✭ 52 (-64.14%)
Mutual labels:  voronoi-diagram, delaunay-triangulation
4dvideo
Capturing volumetric videos with Google Tango, RealSense R200 and Delaunay triangulation
Stars: ✭ 35 (-75.86%)
Mutual labels:  delaunay-triangulation
FortuneAlgorithm
A C++ implementation of the Fortune's algorithm for Voronoi diagram construction
Stars: ✭ 44 (-69.66%)
Mutual labels:  voronoi-diagram
WeightedTreemaps
Create Voronoi and Sunburst Treemaps from Hierarchical data
Stars: ✭ 33 (-77.24%)
Mutual labels:  voronoi-diagram
FaceMorphing
Face Morphing by Delaunay Triangulation using OpenCV and C++
Stars: ✭ 20 (-86.21%)
Mutual labels:  delaunay-triangulation
karta
Experiments with map generation using Voronoi diagrams
Stars: ✭ 87 (-40%)
Mutual labels:  voronoi-diagram
jigsaw-python
Python bindings for JIGSAW: a Delaunay-based unstructured mesh generator.
Stars: ✭ 24 (-83.45%)
Mutual labels:  delaunay-triangulation
jigsaw-matlab
MATLAB bindings for JIGSAW: a Delaunay-based unstructured mesh generator.
Stars: ✭ 57 (-60.69%)
Mutual labels:  delaunay-triangulation
SplashGeom
Open-source C++ library for geometry and linear algebra
Stars: ✭ 22 (-84.83%)
Mutual labels:  voronoi-diagram
VoronoiIsland
🏝: Voronoi Island
Stars: ✭ 15 (-89.66%)
Mutual labels:  voronoi-diagram
PGS
Processing Geometry Suite
Stars: ✭ 39 (-73.1%)
Mutual labels:  delaunay-triangulation
Cgal
The public CGAL repository, see the README below
Stars: ✭ 2,825 (+1848.28%)
Mutual labels:  voronoi-diagram
jigsaw-geo-matlab
MATLAB bindings for JIGSAW(GEO): an unstructured mesh generator for geoscientific modelling.
Stars: ✭ 26 (-82.07%)
Mutual labels:  delaunay-triangulation
delaunay
Fast Delaunay triangulation implemented in Go.
Stars: ✭ 100 (-31.03%)
Mutual labels:  delaunay-triangulation
delaunator-rs
Fast 2D Delaunay triangulation in Rust. A port of Delaunator.
Stars: ✭ 115 (-20.69%)
Mutual labels:  delaunay-triangulation
GPU-Voronoi-Noise
GPU Voronoi noise in Unity
Stars: ✭ 44 (-69.66%)
Mutual labels:  voronoi-diagram
Point-Cloud-Triangulation
C++ code for triangulating Point Cloud data and displaying it
Stars: ✭ 29 (-80%)
Mutual labels:  delaunay-triangulation
pycobra
python library implementing ensemble methods for regression, classification and visualisation tools including Voronoi tesselations.
Stars: ✭ 111 (-23.45%)
Mutual labels:  voronoi-diagram
Tinfour
Delaunay and Constrained Delaunay Triangulations in Java, providing high-performance utilities for modeling surfaces with support for Lidar LAS files, Digital Elevation Models (DEM), finite element analysis, path planning, natural neighbor interpolation, and other applications of Triangulated Irregular Networks (TIN)
Stars: ✭ 119 (-17.93%)
Mutual labels:  delaunay-triangulation

PyDelaunay2D

A Simple Delaunay triangulation and Voronoi diagram constructor in 2D. Written by Jose M. Espadero

Just pretend to be a simple and didactic implementation of the Bowyer-Watson algorithm to compute the Delaunay triangulation and the Voronoi diagram of a set o 2D points.

It is written in pure python + numpy (tested with python2.7 and python3). A test example is provided showing how to call and plot the results using matplotlib.

It support the robust inCircle2D predicate from Jonathan Richard Shewchuk, but it is disabled by default due to perfomance penalties, so do not expect to work on degenerate set of points. If you really need to compute triangulation on big or degenerate set of points, try scipy.spatial.Delaunay instead.

How can I use it in my projects?

Here is a minimal example of building a triangulation and dump the result to console.

import numpy as np
from delaunay2D import Delaunay2D

# Create a random set of points
seeds = np.random.random((10, 2))

# Create Delaunay Triangulation and insert points one by one
dt = Delaunay2D()
for s in seeds:
    dt.addPoint(s)

# Dump points and triangles to console
print("Input points:\n", seeds)
print ("Delaunay triangles:\n", dt.exportTriangles())

Is it fast?

No. This code has been written to stay simple, easy to read by beginners and with minimal dependencies instead of highly-optimized. There is a section in addPoint() method that performs specially bad if you have a big set of input points:

    # Search the triangle(s) whose circumcircle contains p 
    for T in self.triangles:
        if self.inCircle(T, p):
            bad_triangles.append(T)

Here, we should avoid iterating over the complete list of triangles. Best way is to use a structure that allows a spatial search (as a QuadTree). Then, continue the search over the neighbours of the initial search.

Despite that, it will compute DT of less than 1000 points in a reasonable time. If you really need to compute triangulation on huge or degenerate sets of points, try scipy.spatial.Delaunay, which is based on Qhull library

Why did you write it?

Mainly, to provide a didactic implementation of the algorithm. Also, because sometimes it is not possible/worth to import the complete scipy.spatial package (for example, when running a script inside of python interpreter included in blender )

References:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].