Primitive Interfaces
Points
DelaunayTriangulation.getx — Functiongetx(c::RepresentativeCoordinates) -> NumberReturns the x-coordinate of c.
getx(c::Cell) -> NumberReturns the x-coordinate of c.
getx(p) -> NumberGet the x-coordinate of p.
Examples
julia> using DelaunayTriangulation
julia> p = (0.3, 0.7);
julia> getx(p)
0.3DelaunayTriangulation.gety — Functiongety(c::RepresentativeCoordinates) -> NumberReturns the y-coordinate of c.
gety(c::Cell) -> NumberReturns the y-coordinate of c.
gety(p) -> NumberGet the y-coordinate of p.
Examples
julia> using DelaunayTriangulation
julia> p = (0.9, 1.3);
julia> gety(p)
1.3DelaunayTriangulation.getxy — Functiongetxy(p) -> NTuple{2, Number}Get the coordinates of p as a Tuple.
Examples
julia> using DelaunayTriangulation
julia> p = [0.9, 23.8];
julia> getxy(p)
(0.9, 23.8)DelaunayTriangulation.is_point2 — Functionis_point2(p) -> BoolTests if p represents a point in the plane. By default, this returns the result of
eltype(p) <: Number && length(p) == 2DelaunayTriangulation.getpoint — Functiongetpoint(points, vertex) -> NTuple{2, Number}Get the point associated with vertex in points, returned as a Tuple of the coordinates. If vertex is not an integer, then vertex is returned so that points and vertices can be easily mixed.
Examples
julia> using DelaunayTriangulation
julia> points = [(0.3, 0.7), (1.3, 5.0), (5.0, 17.0)];
julia> DelaunayTriangulation.getpoint(points, 2)
(1.3, 5.0)
julia> points = [0.3 1.3 5.0; 0.7 5.0 17.0];
julia> DelaunayTriangulation.getpoint(points, 2)
(1.3, 5.0)
julia> DelaunayTriangulation.getpoint(points, (17.3, 33.0))
(17.3, 33.0)DelaunayTriangulation.get_point — Functionget_point(points, vertices...) -> NTuple{length(vertices), NTuple{2, Number}}Get the points associated with vertices in points.
Examples
julia> using DelaunayTriangulation
julia> points = [(1.0, 2.0), (3.0, 5.5), (1.7, 10.3), (-5.0, 0.0)];
julia> get_point(points, 1)
(1.0, 2.0)
julia> get_point(points, 1, 2, 3, 4)
((1.0, 2.0), (3.0, 5.5), (1.7, 10.3), (-5.0, 0.0))
julia> points = [1.0 3.0 1.7 -5.0; 2.0 5.5 10.3 0.0];
julia> get_point(points, 1)
(1.0, 2.0)
julia> get_point(points, 1, 2, 3, 4)
((1.0, 2.0), (3.0, 5.5), (1.7, 10.3), (-5.0, 0.0))
julia> typeof(ans)
NTuple{4, Tuple{Float64, Float64}}DelaunayTriangulation.push_point! — Functionpush_point!(points, x, y)
push_point!(points, p) = push_point!(points, getx(p), gety(p))Pushes the point p = (x, y) into points.
Examples
julia> using DelaunayTriangulation
julia> points = [(1.0, 3.0), (5.0, 1.0)]
2-element Vector{Tuple{Float64, Float64}}:
(1.0, 3.0)
(5.0, 1.0)
julia> DelaunayTriangulation.push_point!(points, 2.3, 5.3)
3-element Vector{Tuple{Float64, Float64}}:
(1.0, 3.0)
(5.0, 1.0)
(2.3, 5.3)
julia> DelaunayTriangulation.push_point!(points, (17.3, 5.0))
4-element Vector{Tuple{Float64, Float64}}:
(1.0, 3.0)
(5.0, 1.0)
(2.3, 5.3)
(17.3, 5.0)DelaunayTriangulation.pop_point! — Functionpop_point!(points)Pops the last point from points.
Examples
julia> using DelaunayTriangulation
julia> points = [(1.0, 2.0), (1.3, 5.3)]
2-element Vector{Tuple{Float64, Float64}}:
(1.0, 2.0)
(1.3, 5.3)
julia> DelaunayTriangulation.pop_point!(points) # returns the popped vector
(1.3, 5.3)
julia> points
1-element Vector{Tuple{Float64, Float64}}:
(1.0, 2.0)DelaunayTriangulation.set_point! — Functionset_point!(points, i, x, y)
set_point!(points, i, p) = set_point!(points, i, getx(p), gety(p))Sets the point at index i in points to (x, y).
Examples
julia> using DelaunayTriangulation
julia> points = [(1.0, 3.0), (5.0, 17.0)]
2-element Vector{Tuple{Float64, Float64}}:
(1.0, 3.0)
(5.0, 17.0)
julia> DelaunayTriangulation.set_point!(points, 1, 0.0, 0.0)
(0.0, 0.0)
julia> points
2-element Vector{Tuple{Float64, Float64}}:
(0.0, 0.0)
(5.0, 17.0)
julia> points = [1.0 2.0 3.0; 4.0 5.0 6.0]
2×3 Matrix{Float64}:
1.0 2.0 3.0
4.0 5.0 6.0
julia> DelaunayTriangulation.set_point!(points, 2, (17.3, 0.0))
2-element view(::Matrix{Float64}, :, 2) with eltype Float64:
17.3
0.0
julia> points
2×3 Matrix{Float64}:
1.0 17.3 3.0
4.0 0.0 6.0DelaunayTriangulation.is_planar — Functionis_planar(points) -> BoolReturns true if all points in points are two-dimensional. The default definition is simply all(is_point2, each_point(points)).
Edges
DelaunayTriangulation.construct_edge — Functionconstruct_edge(::Type{E}, i, j) where {E} -> EConstruct an edge of type E from vertices i and j.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.construct_edge(NTuple{2,Int}, 2, 5)
(2, 5)
julia> DelaunayTriangulation.construct_edge(Vector{Int32}, 5, 15)
2-element Vector{Int32}:
5
15DelaunayTriangulation.initial — Functioninitial(e) -> VertexGet the initial vertex of e.
Examples
julia> using DelaunayTriangulation
julia> e = (1, 3);
julia> DelaunayTriangulation.initial(e)
1
julia> e = [2, 5];
julia> DelaunayTriangulation.initial(e)
2DelaunayTriangulation.terminal — Functionterminal(e) -> VertexGet the terminal vertex of e.
Examples
julia> using DelaunayTriangulation
julia> e = (1, 7);
julia> DelaunayTriangulation.terminal(e)
7
julia> e = [2, 13];
julia> DelaunayTriangulation.terminal(e)
13DelaunayTriangulation.edge_vertices — Functionedge_vertices(e) -> NTuple{2, Vertex}Get the vertices of e
Examples
julia> using DelaunayTriangulation
julia> e = (1, 5);
julia> edge_vertices(e)
(1, 5)
julia> e = [23, 50];
julia> edge_vertices(e)
(23, 50)DelaunayTriangulation.reverse_edge — Functionreverse_edge(e) -> EdgeGet the edge with the vertices of e in reverse order.
Examples
julia> using DelaunayTriangulation
julia> e = (17, 3);
julia> DelaunayTriangulation.reverse_edge(e)
(3, 17)
julia> e = [1, 2];
julia> DelaunayTriangulation.reverse_edge(e)
2-element Vector{Int64}:
2
1DelaunayTriangulation.compare_unoriented_edges — Functioncompare_unoriented_edges(u, v) -> BoolCompare the unoriented edges u and v, i.e. compare the vertices of u and v in any order.
Examples
julia> using DelaunayTriangulation
julia> u = (1, 3);
julia> v = (5, 3);
julia> DelaunayTriangulation.compare_unoriented_edges(u, v)
false
julia> v = (1, 3);
julia> DelaunayTriangulation.compare_unoriented_edges(u, v)
true
julia> v = (3, 1);
julia> DelaunayTriangulation.compare_unoriented_edges(u, v)
trueDelaunayTriangulation.edge_type — Functionedge_type(tri::Triangulation) -> DataTypeReturns the type used for representing individual edges in tri.
edge_type(vorn::VoronoiTessellation) -> DataTypeType used for representing individual edges in the Voronoi tessellation.
edge_type(E) -> DataTypeGet the type of edges in E.
Examples
julia> using DelaunayTriangulation
julia> e = Set(((1,2),(2,3),(17,5)))
Set{Tuple{Int64, Int64}} with 3 elements:
(1, 2)
(17, 5)
(2, 3)
julia> DelaunayTriangulation.edge_type(e)
Tuple{Int64, Int64}
julia> e = [[1,2],[3,4],[17,3]]
3-element Vector{Vector{Int64}}:
[1, 2]
[3, 4]
[17, 3]
julia> DelaunayTriangulation.edge_type(e)
Vector{Int64} (alias for Array{Int64, 1})DelaunayTriangulation.contains_edge — Functioncontains_edge(i, j, E) -> Bool
contains_edge(e, E) -> BoolCheck if E contains the edge e = (i, j).
Examples
julia> using DelaunayTriangulation
julia> E = Set(((1,3),(17,3),(1,-1)))
Set{Tuple{Int64, Int64}} with 3 elements:
(1, -1)
(17, 3)
(1, 3)
julia> DelaunayTriangulation.contains_edge((1, 2), E)
false
julia> DelaunayTriangulation.contains_edge((17, 3), E)
true
julia> DelaunayTriangulation.contains_edge(3, 17, E) # order
false
julia> E = [[1,2],[5,13],[-1,1]]
3-element Vector{Vector{Int64}}:
[1, 2]
[5, 13]
[-1, 1]
julia> DelaunayTriangulation.contains_edge(1, 2, E)
trueDelaunayTriangulation.contains_unoriented_edge — Functioncontains_unoriented_edge(e, E) -> BoolCheck if E contains the unoriented edge e, i.e. check if E contains the edge e or reverse_edge(e).
DelaunayTriangulation.add_to_edges! — Functionadd_to_edges!(E, e)Add the edge e to E.
Examples
julia> using DelaunayTriangulation
julia> E = Set(((1, 2),(3,5)))
Set{Tuple{Int64, Int64}} with 2 elements:
(1, 2)
(3, 5)
julia> DelaunayTriangulation.add_to_edges!(E, (1, 5))
Set{Tuple{Int64, Int64}} with 3 elements:
(1, 2)
(3, 5)
(1, 5)DelaunayTriangulation.delete_from_edges! — Functiondelete_from_edges!(E, e)Delete the edge e from E.
Examples
julia> using DelaunayTriangulation
julia> E = Set(([1,2],[5,15],[17,10],[5,-1]))
Set{Vector{Int64}} with 4 elements:
[17, 10]
[5, 15]
[5, -1]
[1, 2]
julia> DelaunayTriangulation.delete_from_edges!(E, [5, 15])
Set{Vector{Int64}} with 3 elements:
[17, 10]
[5, -1]
[1, 2]DelaunayTriangulation.delete_unoriented_edge! — Functiondelete_unoriented_edge!(E, e)Delete the unoriented edge e from E, i.e. delete both the edge e and reverse_edge(e).
DelaunayTriangulation.random_edge — Functionrandom_edge([rng], E) -> EGet a random edge from E.
Examples
julia> using DelaunayTriangulation, StableRNGs
julia> E = Set(((1,2),(10,15),(23,20)))
Set{Tuple{Int64, Int64}} with 3 elements:
(1, 2)
(23, 20)
(10, 15)
julia> rng = StableRNG(123);
julia> DelaunayTriangulation.random_edge(rng, E)
(10, 15)
julia> DelaunayTriangulation.random_edge(rng, E)
(10, 15)
julia> DelaunayTriangulation.random_edge(rng, E)
(23, 20)julia> DelaunayTriangulation.random_edge(E)
(1, 2)DelaunayTriangulation.edges_are_disjoint — Functionedges_are_disjoint(e, e′) -> BoolReturns true if e and e′ have any shared vertex, and false otherwise.
Triangles
DelaunayTriangulation.construct_triangle — Functionconstruct_triangle(::Type{T}, i, j, k) where {T} -> TriangleConstruct a triangle of type T from vertices i, j, and k.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.construct_triangle(NTuple{3,Int}, 1, 2, 3)
(1, 2, 3)
julia> DelaunayTriangulation.construct_triangle(Vector{Int32}, 1, 2, 3)
3-element Vector{Int32}:
1
2
3DelaunayTriangulation.geti — Functiongeti(T) -> VertexGet the first vertex of T.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.geti((1, 2, 3))
1
julia> DelaunayTriangulation.geti([2, 5, 1])
2DelaunayTriangulation.getj — Functiongetj(T) -> VertexGet the second vertex of T.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.getj((5, 6, 13))
6
julia> DelaunayTriangulation.getj([10, 19, 21])
19DelaunayTriangulation.getk — Functiongetk(T) -> VertexGet the third vertex of T.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.getk((1,2,3))
3
julia> DelaunayTriangulation.getk([1,2,3])
3DelaunayTriangulation.triangle_vertices — Functiontriangle_vertices(T) -> NTuple{3, Vertex}Returns the vertices of T as a Tuple.
Examples
julia> using DelaunayTriangulation
julia> triangle_vertices((1, 5, 17))
(1, 5, 17)
julia> triangle_vertices([5, 18, 23]) # -> tuple
(5, 18, 23)DelaunayTriangulation.triangle_type — Functiontriangle_type(tri::Triangulation) -> DataTypeReturns the type used for representing individual triangles in tri.
triangle_type(::InsertionEventHistory{T}) where {T} = TReturns the type of the triangles in events, T.
triangle_type(vorn::VoronoiTessellation) -> DataTypeType used for representing individual triangles in the Voronoi tessellation.
triangle_type(::Type{T}) -> DataTypeGet the triangle type of T.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.triangle_type(Set{NTuple{3,Int64}})
Tuple{Int64, Int64, Int64}
julia> DelaunayTriangulation.triangle_type(Vector{NTuple{3,Int32}})
Tuple{Int32, Int32, Int32}
julia> DelaunayTriangulation.triangle_type(Vector{Vector{Int64}})
Vector{Int64} (alias for Array{Int64, 1})DelaunayTriangulation.triangle_edges — Functiontriangle_edges(T) -> NTuple{3, Edge}
triangle_edges(i, j, k) -> NTuple{3, Edge}Get the edges of T = (i, j, k) as a Tuple, in particular
((i, j), (j, k), (k, i)).Examples
julia> using DelaunayTriangulation
julia> T = (1, 2, 3);
julia> DelaunayTriangulation.triangle_edges(T)
((1, 2), (2, 3), (3, 1))
julia> DelaunayTriangulation.triangle_edges(1, 2, 3)
((1, 2), (2, 3), (3, 1))DelaunayTriangulation.sort_triangle — Functionsort_triangle(T) -> Triangle
sort_triangle(i, j, k) -> TriangleSort the triangle T = (i, j, k) so that its last vertex is the smallest, respecting the orientation of T.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.sort_triangle((1, 5, 3))
(5, 3, 1)
julia> DelaunayTriangulation.sort_triangle((1, -1, 2))
(2, 1, -1)
julia> DelaunayTriangulation.sort_triangle((3, 2, 1))
(3, 2, 1)DelaunayTriangulation.compare_triangles — Functioncompare_triangles(T, V) -> BoolCompare the triangles T and V by comparing their vertices up to rotation.
Examples
julia> using DelaunayTriangulation
julia> T1 = (1, 5, 10);
julia> T2 = (17, 23, 20);
julia> DelaunayTriangulation.compare_triangles(T1, T2)
false
julia> T2 = (5, 10, 1);
julia> DelaunayTriangulation.compare_triangles(T1, T2)
true
julia> T2 = (10, 1, 5);
julia> DelaunayTriangulation.compare_triangles(T1, T2)
true
julia> T2 = (10, 5, 1);
julia> DelaunayTriangulation.compare_triangles(T1, T2)
falseDelaunayTriangulation.add_to_triangles! — Functionadd_to_triangles!(T, V)Add the triangle V to the collection of triangles T.
Examples
julia> using DelaunayTriangulation
julia> T = Set(((1, 2, 3), (17, 8, 9)));
julia> DelaunayTriangulation.add_to_triangles!(T, (1, 5, 12))
Set{Tuple{Int64, Int64, Int64}} with 3 elements:
(1, 5, 12)
(1, 2, 3)
(17, 8, 9)
julia> DelaunayTriangulation.add_to_triangles!(T, (-1, 3, 6))
Set{Tuple{Int64, Int64, Int64}} with 4 elements:
(1, 5, 12)
(1, 2, 3)
(17, 8, 9)
(-1, 3, 6)DelaunayTriangulation.delete_from_triangles! — Functiondelete_from_triangles!(T, V)Delete the triangle V from the collection of triangles T. Only deletes V if V is in T up to rotation.
Examples
julia> using DelaunayTriangulation
julia> V = Set(((1, 2, 3), (4, 5, 6), (7, 8, 9)))
Set{Tuple{Int64, Int64, Int64}} with 3 elements:
(7, 8, 9)
(4, 5, 6)
(1, 2, 3)
julia> DelaunayTriangulation.delete_from_triangles!(V, (4, 5, 6))
Set{Tuple{Int64, Int64, Int64}} with 2 elements:
(7, 8, 9)
(1, 2, 3)
julia> DelaunayTriangulation.delete_from_triangles!(V, (9, 7, 8))
Set{Tuple{Int64, Int64, Int64}} with 1 element:
(1, 2, 3)Boundary Nodes
DelaunayTriangulation.num_boundary_edges — Functionnum_boundary_edges(boundary_nodes) -> IntegerGet the number of boundary edges in boundary_nodes, assuming that boundary_nodes defines a boundary with only one curve and a single section.
DelaunayTriangulation.each_boundary_node — Functioneach_boundary_node(boundary_nodes) -> IteratorReturns an iterator that goves over each node in boundary_nodes. It is assumed that boundary_nodes represents a single section or a single contiguous boundary; if you do want to loop over every boundary nodes for a boundary with multiple sections, you should to see the result from construct_ghost_vertex_map.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.each_boundary_node([7, 8, 19, 2, 17])
5-element Vector{Int64}:
7
8
19
2
17
julia> DelaunayTriangulation.each_boundary_node([7, 8, 19, 2, 17, 7])
6-element Vector{Int64}:
7
8
19
2
17
7