DelaunayTriangulation.jl

DelaunayTriangulation.jl: A Julia package for Delaunay triangulations and Voronoi tessellations in the plane - Published in JOSS (2024)

https://github.com/juliageometry/delaunaytriangulation.jl

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 10 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

computational-geometry delaunay delaunay-triangulation geometry meshing power-diagram tessellation triangulation voronoi voronoi-diagram

Keywords from Contributors

raytracer pde automatic-differentiation climate climate-change data-assimilation fluid-dynamics ocean interpretability ode
Last synced: 4 months ago · JSON representation ·

Repository

DelaunayTriangulation.jl: A Julia package for Delaunay triangulations and Voronoi tessellations in the plane

Basic Info
Statistics
  • Stars: 88
  • Watchers: 4
  • Forks: 7
  • Open Issues: 7
  • Releases: 60
Topics
computational-geometry delaunay delaunay-triangulation geometry meshing power-diagram tessellation triangulation voronoi voronoi-diagram
Created over 3 years ago · Last pushed 5 months ago
Metadata Files
Readme Changelog Contributing License Citation Zenodo

README.md

DelaunayTriangulation

Stable Dev Coverage DOI Aqua QA

This is a package for constructing Delaunay triangulations and Voronoi tessellations of planar point sets. Supports unconstrained and constrained triangulations, weighted triangulations, mesh refinement, triangulation of curve bounded domains, Voronoi tessellations, power diagrams, and clipped and centroidal Voronoi tessellations. To install the package, do

julia julia>] add DelaunayTriangulation

Many features are available, some of these being:

  • Unconstrained and constrained Delaunay triangulations, supporting many types of domains.
  • Weighted Delaunay triangulations.
  • Computation of Voronoi tessellations, clipped Voronoi tessellations where the Voronoi tiles get clipped to a convex polygon, and centroidal Voronoi tessellations where each Voronoi tile's generator is the tile's centroid.
  • Power diagrams.
  • Mesh refinement, with support for custom angle and area constraints, as well as refinement of curve-bounded domains.
  • Dynamic point insertion, point deletion, and segment insertion, amongst many other operations.
  • Computation of convex hulls.
  • Triangulation of convex polygons.
  • Point location.
  • Computation of the pole of inaccessibility.
  • The interface for defining geometric primitives is fully customisable.

To ensure that the algorithms are robust, by default we make use of AdaptivePredicates.jl to use adaptive arithmetic for all geometric predicates in this package. This choice can be configured, allowing for the additional choices of ExactPredicates.jl or no adaptive or exact arithmetic at all; see the documentation. Much of the work in this package is derived from the book Delaunay Mesh Generation by Cheng, Dey, and Shewchuk (2013). Please see the documentation for much more information.

Some examples are below (and in the documentation), but if you would also like to see how DelaunayTriangulation.jl is used in other packages, see FiniteVolumeMethod.jl (solving 2D PDEs) and NaturalNeighbours.jl (scattered data interpolation).

If you would like to make an issue or contribute, please see the CONTRIBUTING.md file. For feature requests, please see the discussions tab.

Example Usage

Here is a quick example of some ways the package can be used. As mentioned, see the docs for many examples.

```julia

using Pkg; Pkg.add(["DelaunayTriangulation", "CairoMakie", "StableRNGs"])

using DelaunayTriangulation, CairoMakie, StableRNGs

Unconstrained

points = rand(2, 50) tri1 = triangulate(points) # default predicate kernel is AdaptiveKernel()

Voronoi example

vorn2 = voronoi(tri1)

Clipped Voronoi

vorn3 = voronoi(tri1, clip=true, predicates = ExactKernel())

Smoothed Voronoi

vorn4 = centroidal_smooth(vorn3; predicates = FastKernel()) # or do voronoi(tri1, clip = true, smooth = true)

Constrained example with refinement

boundarypoints = [(0.0, 0.0), (1.0, 0.0), (1.0, 0.3), (0.5, 0.3), (0.3, 0.7), (0.1, 1.0), (0.0, 1.0), (0.0, 0.0)] boundarynodes, points = convertboundarypointstoindices(boundarypoints) tri5 = triangulate(points; boundarynodes) refine!(tri5; maxarea=1e-2getarea(tri5))

Disjoint constrained example with refinement

boundarypoints = [ [[(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0), (0.0, 0.0)]], [[(0.3, 0.3), (0.3, 0.7), (0.7, 0.7), (0.7, 0.3), (0.3, 0.3)]], [[(1.2, 0.0), (1.4, 0.0), (1.4, 1.2), (0.0, 1.2), (0.0, 1.1), (1.1, 1.1), (1.1, 0.0), (1.2, 0.0)]] ] boundarynodes, points = convertboundarypointstoindices(boundarypoints) tri6 = triangulate(points; boundarynodes) refine!(tri6; maxarea=1e-2getarea(tri6))

Curve-bounded example

using DelaunayTriangulation: EllipticalArc ellipse = EllipticalArc((1.0, 0.0), (1.0, 0.0), (0.0, 0.0), 1.0, 2.0, 0.0) tri7 = triangulate(NTuple{2,Float64}[]; boundarynodes=[ellipse]) refine!(tri7; maxarea=1e-2get_area(tri7))

Disjoint curve-bounded example

ellipse = EllipticalArc((7.0, 3.5), (7.0, 3.5), (0.0, 3.5), 7.0, 10.0, 0.0) catmullcp = [(0.0, 0.0), (-2.0, -1.0), (-4.0, 0.0), (-5.0, 2.0), (-1.0, 4.0), (0.0, 3.0), (1.0, 4.0), (5.0, 2.0), (4.0, 0.0), (2.0, -1.0), (0.0, 0.0)] catmullspl = CatmullRomSpline(catmullcp) circle = CircularArc((0.5, 1.5), (0.5, 1.5), (0.0, 1.0)) circle2 = CircularArc((0.1, 1.5), (0.1, 1.5), (0.0, 1.0), positive=false) points = [(-4.0, -10.0), (4.0, -10.0), (4.0, -7.0), (-4.0, -7.0)] square = [1, 2, 3, 4, 1] boundarynodes = [[square], [[ellipse]], [[catmullspl]], [[circle]], [[circle2]]] tri8 = triangulate(points; boundarynodes) refine!(tri8; maxarea=1e-2getarea(tri8)) # could also use find_polygon to help define a custom refinement function for each shape

Weighted triangulation example

rng = StableRNG(1) # You can pass rngs for reproducibility. Alternatively, just use Random.seed!(n) points = tuple.(rand(rng, 20), rand(rng, 20)) weights = 3randn(rng, 20) tri9 = triangulate(points; weights, rng)

Power diagram example

points = tuple.(rand(rng, 100), rand(rng, 100)) weights = rand(rng, 100) tri10 = triangulate(points; weights, rng) vorn10 = voronoi(tri10) # can also use clip/smooth here

Clipped Voronoi example with a generic convex polygon

points = 10randn(rng, 2, 100) weights = rand(rng, 100) circ = CircularArc((0.0, 5.0), (0.0, 5.0), (0.0, 0.0)) # clip to a circle clippoints = [circ(t) for t in LinRange(0, 1, 100)] clipvertices = [1:(length(clippoints)-1); 1] tri11 = triangulate(points; weights, rng) vorn11 = voronoi(tri11, clip=true, clippolygon=(clippoints, clipvertices), rng=rng)

Plotting

fig = Figure(fontsize = 42, size = (2800, 2200)) wh = (width = 600, height = 600) ax = Axis(fig[1, 1]; title = "Unconstrained", wh...); triplot!(ax, tri1) ax = Axis(fig[1, 2]; title = "Voronoi", wh...); voronoiplot!(ax, vorn2) ax = Axis(fig[1, 3]; title = "Clipped Voronoi", wh...); voronoiplot!(ax, vorn3) ax = Axis(fig[1, 4]; title = "Centroidal Voronoi", wh...); voronoiplot!(ax, vorn4) ax = Axis(fig[2, 1]; title = "Constrained", wh...); triplot!(ax, tri5) ax = Axis(fig[2, 2]; title = "Disjoint Constrained", wh...); triplot!(ax, tri6) ax = Axis(fig[2, 3]; title = "Curve-Bounded", wh...); triplot!(ax, tri7) ax = Axis(fig[2, 4]; title = "Disjoint Curve-Bounded", wh...); triplot!(ax, tri8) ax = Axis(fig[3, 1]; title = "Weighted", wh...); triplot!(ax, tri9) ax = Axis(fig[3, 2]; title = "Power Diagram", wh...); voronoiplot!(ax, vorn10) ax = Axis(fig[3, 3]; title = "Clipped Voronoi", wh...); voronoiplot!(ax, vorn11, color=:white, strokewidth = 4) ```

Citing DelaunayTriangulation.jl

If you use DelaunayTriangulation.jl, please cite it. There is a JOSS paper published at https://doi.org/10.21105/joss.07174. The BibTeX entry for this paper is:

bibtex @article{VandenHeuvel2024DelaunayTriangulation, author = {VandenHeuvel, Daniel J.}, doi = {10.21105/joss.07174}, journal = {Journal of Open Source Software}, month = sep, number = {101}, pages = {7174}, title = {{DelaunayTriangulation.jl: A Julia package for Delaunay triangulations and Voronoi tessellations in the plane}}, url = {https://joss.theoj.org/papers/10.21105/joss.07174}, volume = {9}, year = {2024} }

License

DelaunayTriangulation.jl is provided under a MIT license.

Similar Packages

This is not the only Delaunay triangulation package available. Some others are:

  • VoronoiDelaunay.jl: A pure Julia library that constructs planar triangulations and tessellations like in this package, although no support for constrained triangulations / mesh refinement or clipped / centroid tessellations. Restricts points to $[1, 2] \times [1, 2]$.
  • VoronoiCells.jl: A pure Julia library that extends VoronoiDelaunay.jl. This package provides useful tools for constructing and working with Voronoi tessellations. Supports clipping Voronoi cells to a specified rectangle. Like VoronoiDelaunay.jl, restricts points to $[1, 2] \times [1, 2]$.
  • Delaunay.jl: Wraps Python's main Delaunay triangulation library, scipy.spatial.Delaunay, for computing Delaunay triangulations in $\mathbb R^N$. I don't believe constrained triangulations or mesh refinement is available here.
  • MiniQhull.jl: Wraps Qhull for computing unconstrained Delaunay triangulations in $\mathbb R^N$. No support is provided for mesh refinement.
  • DirectQhull.jl: Similar to MiniQhull.jl, although also provides support for convex hulls and Voronoi tessellations from Qhull.
  • Delaunator.jl: A pure Julia library modelled after the JavaScript Delaunator library. This package can construct unconstrained triangulations of planar point sets. No support is available for constrained triangulations or mesh refinement, although support exists for computing the dual Voronoi tessellation. Centroidal tessellations are not implemented, although the Voronoi cells can be clipped to a bounding box.
  • TriangleMesh.jl, Triangulate.jl, Triangle.jl: Interfaces to Shewchuk's Triangle library.
  • TetGen.jl: This is for Delaunay tetrahedralisation, wrapping TetGen.
  • GMT.jl: A wrapper of GMT, allowing for unconstrained Delaunay triangulations in two dimensions, and for spherical triangulation, i.e. triangulation of points lying on a sphere.
  • Quickhull.jl: A pure Julia library for unconstrained triangulations, Voronoi tessellations, and convex hulls in $N$ dimensions.

In addition to these Julia packages, software packages in other programming languages are available, such as:

  • Triangle: A C library for generating (constrained) Delaunay triangulations, Voronoi tessellations, and refined meshes. Also supports weighted triangulations. As mentioned above, there is a Julia interface to this library through TriangleMesh.jl, Triangulate.jl, or Triangle.jl.
  • CGAL: A C++ library which, among many other features relevant in computational geometry, supports Delaunay triangulations, spherical triangulations, periodic triangulations, constrained triangulations, 3D Delaunay triangulations, Voronoi tessellations, mesh refinement, surface triangulations, and more.
  • Gmsh: Gmsh is a finite element mesh generator with many features, providing constrained Delaunay triangulations (or, in addition to triangles, elements can also be mixed with e.g. squares) and mesh refinement with many options. Provides a set of meshing algorithms to choose from. Supports both 2D and 3D meshing. In addition to simple segments, you can also provide curves for boundaries and surfaces in the 3D case. Has interfaces in several languages, including Gmsh.jl.
  • SciPy: A Python library providing Delaunay triangulations, Voronoi tessellations, and convex hulls in $\mathbb R^N$. Does not support constrained triangulations or mesh refinement.
  • MATLAB: MATLAB has built-in functions for Delaunay triangulations and Voronoi tessellations in two and three dimensions. Additionally, it supports constrained triangulations and mesh refinement.
  • Qhull: A C library for computing Delaunay triangulations, Voronoi tessellations, and convex hulls in $\mathbb R^N$. No support is provided for constrained triangulations or mesh refinement, but it does provide furthest-site Delaunay triangulations and furthest-site Voronoi tessellations. The packages MiniQhull.jl and DirectQhull.jl wrap Qhull for use in Julia.
  • Delaunator: A JavaScript library that provides support for fast construction of two-dimensional unconstrained Delaunay triangulations.
  • Spade: A Rust library providing support for Delaunay triangulations and constrained Delaunay triangulations, mesh refinement, and Voronoi tessellations in the plane.
  • Acute: A C library that builds on top of Shewchuk's Triangle library, being the first of its kind to not only allow for minimum angle constraints in mesh refinement, but also for maximum angle constraints.
  • Tinfour: A Java library for Delaunay triangulations and constrained Delaunay triangulations in the plane, with a lot of features for interpolation.
  • JTS: A Java library which, among many other features for working with vectory geometries, supports Delaunay triangulations, constrained Delaunay triangulations, mesh refinement (at least to make a conformal triangulation), and Voronoi tessellations.
  • Voro++: A C++ library for constructing Voronoi tessellations, power diagrams, and clipped tessellations.
  • Stellar: A C library for constructing three-dimensional Delaunay triangulations, providing the ability to efficiently refine the mesh.

Compared to all these other libraries, and only in the context of planar triangulations, DelaunayTriangulation.jl is one of the most developed in terms of the features provided, except possibly with the exception of CGAL and Gmsh who provide many features although neither are in the public domain (CGAL being GPL v3+ and Gmsh being GPL v2+), unlike DelaunayTriangulation.jl which is MIT licensed. A tabular comparison of all these packages is given below (focusing only on two dimensional meshing). If there are any errors in this comparison, please let me know. Also please note that the features listed are not intended to be exhaustive, but rather to give a general idea of the capabilities of each package, and certainly not all software packages are listed here.

Comparison

Owner

  • Name: JuliaGeometry
  • Login: JuliaGeometry
  • Kind: organization

Computational Geometry with Julia

JOSS Publication

DelaunayTriangulation.jl: A Julia package for Delaunay triangulations and Voronoi tessellations in the plane
Published
September 27, 2024
Volume 9, Issue 101, Page 7174
Authors
Daniel J. VandenHeuvel ORCID
Department of Mathematics, Imperial College London, UK
Editor
Vissarion Fisikopoulos ORCID
Tags
geometry visualisation computational geometry triangulation tessellation

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- family-names: VandenHeuvel
  given-names: Daniel J.
  orcid: "https://orcid.org/0000-0001-6462-0135"
contact:
- family-names: VandenHeuvel
  given-names: Daniel J.
  orcid: "https://orcid.org/0000-0001-6462-0135"
doi: 10.5281/zenodo.13847646
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - family-names: VandenHeuvel
    given-names: Daniel J.
    orcid: "https://orcid.org/0000-0001-6462-0135"
  date-published: 2024-09-27
  doi: 10.21105/joss.07174
  issn: 2475-9066
  issue: 101
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 7174
  title: "DelaunayTriangulation.jl: A Julia package for Delaunay
    triangulations and Voronoi tessellations in the plane"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.07174"
  volume: 9
title: "DelaunayTriangulation.jl: A Julia package for Delaunay
  triangulations and Voronoi tessellations in the plane"

GitHub Events

Total
  • Create event: 12
  • Commit comment event: 12
  • Release event: 4
  • Issues event: 14
  • Watch event: 20
  • Delete event: 6
  • Issue comment event: 40
  • Push event: 60
  • Pull request event: 16
Last Year
  • Create event: 12
  • Commit comment event: 12
  • Release event: 4
  • Issues event: 14
  • Watch event: 20
  • Delete event: 6
  • Issue comment event: 40
  • Push event: 60
  • Pull request event: 16

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 687
  • Total Committers: 8
  • Avg Commits per committer: 85.875
  • Development Distribution Score (DDS): 0.019
Past Year
  • Commits: 43
  • Committers: 3
  • Avg Commits per committer: 14.333
  • Development Distribution Score (DDS): 0.047
Top Committers
Name Email Commits
DanielVandH d****l@g****m 674
dependabot[bot] 4****] 5
Júlio Hoffimann j****n@g****m 2
Anshul Singhvi a****i@g****m 2
himcraft 1****y@g****m 1
Simon s****h@p****m 1
Matteo Grandin m****n@g****m 1
CompatHelper Julia c****y@j****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 47
  • Total pull requests: 59
  • Average time to close issues: 3 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 17
  • Total pull request authors: 5
  • Average comments per issue: 3.45
  • Average comments per pull request: 1.46
  • Merged pull requests: 48
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 18
  • Pull requests: 31
  • Average time to close issues: 1 day
  • Average time to close pull requests: 8 days
  • Issue authors: 13
  • Pull request authors: 3
  • Average comments per issue: 2.5
  • Average comments per pull request: 1.55
  • Merged pull requests: 24
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • DanielVandH (35)
  • Kevin-Mattheus-Moerman (3)
  • asinghvi17 (2)
  • dgleich (1)
  • JuliaTagBot (1)
  • mtsch (1)
  • rubenseyer (1)
  • PieterjanRobbe (1)
  • ahojukka5 (1)
  • matbesancon (1)
  • EdsterG (1)
  • vissarion (1)
  • TongTongYee (1)
  • lazarusA (1)
  • tkoenig1 (1)
Pull Request Authors
  • DanielVandH (93)
  • dependabot[bot] (10)
  • asinghvi17 (4)
  • juliohm (4)
  • matgrand (2)
  • himcraft (1)
Top Labels
Issue Labels
enhancement (8) help wanted (7) good first issue (5) documentation (3) bug (2) 3D (1) speculative (1) question (1) skip-news (1)
Pull Request Labels
skip-news (25) dependencies (10) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 4,432 total
  • Total dependent packages: 4
  • Total dependent repositories: 0
  • Total versions: 60
juliahub.com: DelaunayTriangulation

DelaunayTriangulation.jl: A Julia package for Delaunay triangulations and Voronoi tessellations in the plane

  • Versions: 60
  • Dependent Packages: 4
  • Dependent Repositories: 0
  • Downloads: 4,432 Total
Rankings
Dependent repos count: 9.9%
Dependent packages count: 23.0%
Average: 30.1%
Stargazers count: 34.1%
Forks count: 53.5%
Last synced: 4 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v3 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-docdeploy v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/Downstream.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v3 composite
  • julia-actions/julia-buildpkg latest composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/setup-julia v1 composite