{"id":22647902,"url":"https://github.com/juliageometry/voronoidelaunay.jl","last_synced_at":"2025-08-14T07:43:43.945Z","repository":{"id":721673,"uuid":"25375496","full_name":"JuliaGeometry/VoronoiDelaunay.jl","owner":"JuliaGeometry","description":"Fast and robust Voronoi \u0026 Delaunay tessellation creation with Julia","archived":false,"fork":false,"pushed_at":"2023-06-28T11:42:07.000Z","size":662,"stargazers_count":124,"open_issues_count":14,"forks_count":26,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-27T12:42:31.567Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaGeometry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-10-17T20:20:45.000Z","updated_at":"2024-09-24T14:22:09.000Z","dependencies_parsed_at":"2022-07-07T14:31:54.581Z","dependency_job_id":"fc9f71b0-a4ee-452d-a2fa-eff4f6f89e36","html_url":"https://github.com/JuliaGeometry/VoronoiDelaunay.jl","commit_stats":{"total_commits":92,"total_committers":17,"mean_commits":5.411764705882353,"dds":0.4347826086956522,"last_synced_commit":"02a2eb7ae95d4e289176878324cb40f009ca66b4"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/JuliaGeometry/VoronoiDelaunay.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaGeometry%2FVoronoiDelaunay.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaGeometry%2FVoronoiDelaunay.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaGeometry%2FVoronoiDelaunay.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaGeometry%2FVoronoiDelaunay.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaGeometry","download_url":"https://codeload.github.com/JuliaGeometry/VoronoiDelaunay.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaGeometry%2FVoronoiDelaunay.jl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270385016,"owners_count":24574537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T07:35:37.349Z","updated_at":"2025-08-14T07:43:43.903Z","avatar_url":"https://github.com/JuliaGeometry.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VoronoiDelaunay.jl\n\n\u003e ⚠️ This package is in maintenance mode.\n\u003e Please consider newer packages such as\n\u003e [DelaunayTriangulation.jl](https://github.com/DanielVandH/DelaunayTriangulation.jl)\n\nFast, robust construction of 2D Delaunay and Voronoi tessellations on generic point types.\nImplementation follows algorithms described in the [Arepo paper](http://arxiv.org/abs/0901.4107)\nand used (for e.g.) in the [Illustris Simulation](http://www.illustris-project.org/). License: MIT. Bug reports welcome!\n\nHow does it work?\n--------------------\nIncrementally insert points to a valid Delaunay tessallation, while restoring Delaunayhood by flipping triangles.\nPoint location (i.e. which triangle should it divide into three) is accelerated by spatial sorting.\nSpatial sorting allows to add points which are close in space thus walking the tesselation is fast.\nInitial tessalletion includes two triangles built by 4 points which are outside of the allowed region for users.\nThese \"external\" triangles are skipped when iterating over Delaunay/Voronoy edges. Fast and robust predicates are\nprovided by the [GeometricalPredicates](https://github.com/skariel/GeometricalPredicates.jl) package. Benchmarks suggest this package is a bit faster than CGAL, see [here](https://gist.github.com/skariel/3d2018f9341a058e00fc) benchmark of an older version which is also a bit slower than current.\n\nCurrent limitations\n--------------------\n* Due to numerical restrictions the point coordinates must be within `min_coord \u003c= x \u003c= max_coord` where `min_coord=1.0+eps(Float64)` and `max_coord=2.0-2eps(Float64)`. Note this is a bit different than what is required by the  `GeometricalPredicates` package.\n* The following features are not implemented, but are in the TODO list; In order of priority: centroid tessellations (Lloy's method), Weighted generators (both power and sum), bounding, maybe restricting. Hierarchal tessellations for fast random locatings; Distributed tessellation construction. 3D. Order of priority may change of course :)\n\nHow to use?\n--------------\n### Installation\n```Julia\n]add VoronoiDelaunay\n```\n### Building a tessellation\nDefine and push individual points like this:\n```Julia\nusing VoronoiDelaunay\ntess = DelaunayTessellation()\npush!(tess, Point(1.5, 1.5))\n```\ncreation of points is explained in the [GeometricalPredicates](https://github.com/skariel/GeometricalPredicates.jl) package documentation.\n\nPushing arrays of points is more efficient:\n```Julia\nwidth = max_coord - min_coord\na = Point2D[Point(min_coord + rand() * width, min_coord + rand() * width) for i in 1:100]\npush!(tess, a)\n```\nnotice care taken for correct range of coordinates. `min_coord` and `max_coord` are defined in the package. We can further optimize by giving a `sizehint` at time of construction:\n```Julia\ntess = DelaunayTessellation(100)\n```\nor at any later point:\n```Julia\nsizehint(tess, 100)\n```\n### Iterating\nDelaunay tesselations need at least 3 points to be well defined. Voronoi need 4. Remember this when iterating or plotting.\nIterating over Delaunay edges is done like this:\n```Julia\ni = 0\nfor edge in delaunayedges(tess)\n    i += 1\n    # or, do something more useful :)\nend\n```\na `DelaunayEdge` contains two points a and b, they can be accessed with `geta(edge)` and `getb(edge)`.\nIterating over Voronoi edges is similar:\n```Julia\ni = 0\nfor edge in voronoiedges(tess)\n    i += 1\n    # or, do something more useful :)\nend\n```\na `VoronoiEdge` is a bit different than a `DelaunayEdge`: here `a` and `b` are `Point2D` and not the generators, as they have different coordinates. To get the generators use `getgena(edge)` and `getgenb(edge)` these give the relevant `AbstractPoint2D` which were used to create the edge.\n\nIf the generators are not needed when iterating over the Voronoi edges (e.g. when plotting) then a more efficient way to iterate is:\n```Julia\ni = 0\ne = Nothing\nfor edge in voronoiedgeswithoutgenerators(tess)\n    i += 1\n    # do something more useful here :)\nend\n```\nhere `edge` is a `VoronoiEdgeWithoutGenerators`, the points `a` and `b` can be accessed as usual.\n\nIterating over Delaunay triangles:\n```Julia\ni = 0\nfor delaunaytriangle in tess\n    i += 1\n    # or, do something more useful :)\nend\n```\n`delaunaytriangle` here is of type `DelaunayTriangle` which is a subtype of `AbstractNegativelyOrientedTriangle`. To get the generators of this triangle use the `geta`, `getb`, and `getc` methods. You can do all other operations and predicate tests on this triangle as explained in [GeometricalPredicates](https://github.com/skariel/GeometricalPredicates.jl)\n\n### Navigating\nLocating a point, i.e. finding the triangle it is inside:\n```Julia\nt = locate(tess, Point(1.2, 1.3))\n```\nif the point is outside of the tessellation then `isexternal(t) == true` holds. This is good for type stability, at least better than returning a `Nothing`. It is assumed that the point we want to locate is actually in the allowed points region. Performance is best when locating points close to each other (this is also why spatial sorting is used). Future versions may implement a hierarchal approach for fast random locations.\n\nNavigating from a triangle to its neighbours is done like this:\n```Julia\nt = movea(tess, t)  # move to the direction infront of generator a\nt = moveb(tess, t)  # move to the direction infront of generator b\nt = movec(tess, t)  # move to the direction infront of generator c\n```\n\n### Plotting\nThe following retrieves a couple of vectors ready to plot Voronoi edges:\n```Julia\nx, y = getplotxy(voronoiedges(tess))\n```\nand for Delaunay edges:\n```Julia\nx, y = getplotxy(delaunayedges(tess))\n```\nNow plotting can be done with your favorite plotting package, for e.g.:\n```Julia\nusing Gadfly\nplot(x=x, y=y, Geom.path)\n```\nTo make a nice looking plot remember to limit the axes and aspect ratio. For e.g.:\n```Julia\nset_default_plot_size(15cm, 15cm)\nplot(x=x, y=y, Geom.path, Scale.x_continuous(minvalue=1.0, maxvalue=2.0), Scale.y_continuous(minvalue=1.0, maxvalue=2.0))\n```\n\n### From an image\nYou can create a tesselation from an image, just like the tesselation of the\njulia logo at the top of this README. This was created from a png with `from_file`\n(see `examples/img_to_vorono.jl`):\n```Julia\nimport Images: imread\nimg = imread(\"julia.png\")\ntess = from_image(img, 25000)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliageometry%2Fvoronoidelaunay.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliageometry%2Fvoronoidelaunay.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliageometry%2Fvoronoidelaunay.jl/lists"}