Skip to content

Commit 1597d66

Browse files
authored
Voronoi tessellations (#47)
1 parent 001032c commit 1597d66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3923
-140
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ docs/src/triangulations/waste.jl
1616
docs/animation.jl
1717
test/animation.jl
1818
test/tassy.txt
19+
lloyd_animation.mp4

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DelaunayTriangulation"
22
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
33
authors = ["Daniel VandenHeuvel <[email protected]>"]
4-
version = "0.5.2"
4+
version = "0.6.0"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ This is a package for constructing Delaunay triangulations of planar point sets.
1818
- [Fully customisable interface](https://danielvandh.github.io/DelaunayTriangulation.jl/dev/interface/interface/) for defining geometric primitives.
1919
- [Simple iteration over mesh elements, including points, edges, or triangles](https://danielvandh.github.io/DelaunayTriangulation.jl/dev/data_structures/triangulation/).
2020
- Computation of [statistics](https://danielvandh.github.io/DelaunayTriangulation.jl/dev/data_structures/statistics/) over individual triangular elements and over a complete triangulation.
21+
- [Computation of Voronoi tessellations](https://danielvandh.github.io/DelaunayTriangulation.jl/dev/tessellations/voronoi.md), including [clipping of polygons to the convex hull]((https://danielvandh.github.io/DelaunayTriangulation.jl/dev/tessellations/clipped.md)). I hope to get this working for constrained triangulations, but it's difficult.
22+
- Computation of [centroidal Voronoi tessellations](https://danielvandh.github.io/DelaunayTriangulation.jl/dev/tessellations/lloyd.md) using Lloyd's algorithm.
2123

2224
Much of the work in this package is derived from the book *Delaunay Mesh Generation* by Cheng, Dey, and Shewchuk (2013).
2325

@@ -27,5 +29,4 @@ Just as a nice demonstration of the incremental behaviour of the algorithms in t
2729

2830
https://user-images.githubusercontent.com/95613936/232210266-615e08bd-d4f2-4a40-849e-e832778a4b71.mp4
2931

30-
31-
32+
Here is also a nice animation showing the computation of a centroidal Voronoi tessellation.

docs/make.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ makedocs(;
2424
"Plotting" => "triangulations/plotting.md",
2525
"Convex Polygons" => "triangulations/convex.md"
2626
],
27+
"Voronoi Tessellations" => [
28+
"Voronoi Tessellations" => "tessellations/voronoi.md",
29+
"Clipped Voronoi Tessellations" => "tessellations/clipped.md",
30+
"Centroidal Voronoi Tessellation" => "tessellations/lloyd.md",
31+
"Plotting" => "tessellations/plotting.md"
32+
],
2733
"Boundary Handling" => "boundary_handling.md",
2834
"Data Structures" => [
2935
"Adjacent" => "data_structures/adjacent.md",
3036
"Adjacent2Vertex" => "data_structures/adjacent2vertex.md",
3137
"Graph" => "data_structures/graph.md",
3238
"Convex Hull" => "data_structures/convex_hull.md",
3339
"Triangulation" => "data_structures/triangulation.md",
34-
"Statistics" => "data_structures/statistics.md"
40+
"Statistics" => "data_structures/statistics.md",
41+
"Voronoi Tessellation" => "data_structures/voronoi.md"
3542
],
3643
"Operations" => "operations.md",
3744
"Other Features" => [

docs/src/data_structures/statistics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Delaunay Triangulation Statistics.
7777
All the relevant docstrings for working with these structs are below.
7878

7979
```@docs
80+
get_all_stat
8081
num_vertices(::TriangulationStatistics)
8182
num_solid_vertices(::TriangulationStatistics)
8283
num_ghost_vertices(::TriangulationStatistics)
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
```@meta
2+
CurrentModule = DelaunayTriangulation
3+
```
4+
5+
# Voronoi Tessellation
6+
7+
The data structure for a Voronoi tessellation is reasonably simple. The data structure here is probably not as exhaustive as it could be, but it is sufficient.
8+
9+
```@docs
10+
VoronoiTessellation
11+
```
12+
13+
Each field has its own accessor:
14+
15+
```@docs
16+
get_triangulation(::VoronoiTessellation)
17+
get_generators(::VoronoiTessellation)
18+
get_polygon_points(::VoronoiTessellation)
19+
get_polygons(::VoronoiTessellation)
20+
get_circumcenter_to_triangle(::VoronoiTessellation)
21+
get_triangle_to_circumcenter(::VoronoiTessellation)
22+
get_unbounded_polygons(::VoronoiTessellation)
23+
get_cocircular_circumcenters(::VoronoiTessellation)
24+
get_adjacent(::VoronoiTessellation)
25+
get_boundary_polygons(::VoronoiTessellation)
26+
```
27+
28+
There are several useful methods available for working with this data structure. We list some of these below; for functions that actually construct the tessellation, see the dedicated tessellation section in the sidebar.
29+
30+
## Type queries
31+
32+
```@docs
33+
edge_type(::VoronoiTessellation{Tr,P,I,T,S,E}) where {Tr,P,I,T,S,E}
34+
number_type(::VoronoiTessellation{Tr,P}) where {Tr,P}
35+
integer_type(::VoronoiTessellation{Tr,P,I}) where {Tr,P,I}
36+
triangle_type(::VoronoiTessellation{Tr,P,I,T}) where {Tr,P,I,T}
37+
```
38+
39+
## Getters
40+
41+
```@docs
42+
get_generator(::VoronoiTessellation, ::Any)
43+
get_polygon_point(::VoronoiTessellation, ::Any)
44+
get_polygon(::VoronoiTessellation, ::Any)
45+
get_circumcenter_to_triangle(::VoronoiTessellation, ::Any)
46+
get_triangle_to_circumcenter(::VoronoiTessellation, ::Any)
47+
get_polygon_coordinates
48+
get_neighbouring_boundary_edges
49+
```
50+
51+
## Nums
52+
53+
```@docs
54+
num_polygons
55+
num_polygon_vertices
56+
num_generators
57+
```
58+
59+
## Adders
60+
61+
```@docs
62+
add_polygon!
63+
push_polygon_point!
64+
add_unbounded_polygon!
65+
delete_unbounded_polygon!
66+
add_boundary_polygon!
67+
```
68+
69+
## Iterators
70+
71+
```@docs
72+
each_generator
73+
each_polygon_vertex
74+
each_unbounded_polygon
75+
each_polygon
76+
each_polygon_index
77+
```
78+
79+
## Adjacent
80+
81+
```@docs
82+
get_adjacent(::VoronoiTessellation, ::Any)
83+
add_adjacent!(::VoronoiTessellation, ::Any, ::Any)
84+
delete_adjacent!(::VoronoiTessellation, ::Any, ::Any)
85+
delete_polygon_adjacent!
86+
add_polygon_adjacent!
87+
```
88+
89+
## Features
90+
91+
```@docs
92+
polygon_features(::VoronoiTessellation, ::Any)
93+
get_area
94+
get_centroid
95+
polygon_bounds(::VoronoiTessellation, ::Any)
96+
jump_and_march(::VoronoiTessellation, ::Any)
97+
```
98+
99+
## Utilities
100+
101+
```@docs
102+
get_surrounding_polygon(::VoronoiTessellation, ::Any)
103+
convert_to_boundary_edge(::VoronoiTessellation, :Any)
104+
```

docs/src/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ CurrentModule = DelaunayTriangulation
66

77
Documentation for [DelaunayTriangulation](https://github.com/DanielVandH/DelaunayTriangulation.jl).
88

9-
This is a package for computing Delaunay triangulations of planar point sets. We support both unconstrained and constrained Delaunay triangulations, as well as mesh refinement with Rupper's algorithm. An interface for computing constrained Delaunay triangulations with Gmsh is also available if needed; see the Gmsh discussion in the sidebar. Unconstrained Delaunay triangulations are computed with the Bowyer-Watson algorithm, and constrained Delaunay triangulations are computed with the incremental algorithm given by [https://doi.org/10.1016/j.comgeo.2015.04.006](https://doi.org/10.1016/j.comgeo.2015.04.006).
9+
This is a package for computing Delaunay triangulations of planar point sets. We support both unconstrained and constrained Delaunay triangulations, as well as mesh refinement with Rupper's algorithm. We also support Voronoi tessellations, clipped Voronoi tessellations, and central Voronoi tessellations; for these latter two cases, the triangulation is treated as constrained with the convex hull edges, but we do not support general boundary constraints for tessellations - if you do know about this, get in touch!
10+
11+
An interface for computing constrained Delaunay triangulations with Gmsh is also available if needed; see the Gmsh discussion in the sidebar. Unconstrained Delaunay triangulations are computed with the Bowyer-Watson algorithm, and constrained Delaunay triangulations are computed with the incremental algorithm given by [https://doi.org/10.1016/j.comgeo.2015.04.006](https://doi.org/10.1016/j.comgeo.2015.04.006).
1012

1113
To ensure that the triangulations are robust to degeneracies, we use ExactPredicates.jl for all geometrical predicates. The results from these predicates are handled through a Certificate module, as outlined in the predicates section in the sidebar.
1214

docs/src/interface/edges.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ terminal
1919
```@docs
2020
edge_indices
2121
reverse_edge
22+
compare_unoriented_edge
2223
```
2324

2425
## Collection of Edges
-193 Bytes
Loading

docs/src/interface/points.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ num_points
3333
number_type
3434
push_point!
3535
pop_point!
36+
set_point!
3637
```
3738

3839
### Generic Methods
3940

4041
```@docs
4142
get_point
4243
points_are_unique
43-
lexicographic_order
44+
lexicographic_order
45+
mean_points
4446
```

0 commit comments

Comments
 (0)