Primitive Interfaces

Points

DelaunayTriangulation.getxFunction
getx(c::RepresentativeCoordinates) -> Number

Returns the x-coordinate of c.

source
getx(c::Cell) -> Number

Returns the x-coordinate of c.

source
getx(p) -> Number

Get the x-coordinate of p.

Examples

julia> using DelaunayTriangulation

julia> p = (0.3, 0.7);

julia> getx(p)
0.3
source
DelaunayTriangulation.getyFunction
gety(c::RepresentativeCoordinates) -> Number

Returns the y-coordinate of c.

source
gety(c::Cell) -> Number

Returns the y-coordinate of c.

source
gety(p) -> Number

Get the y-coordinate of p.

Examples

julia> using DelaunayTriangulation

julia> p = (0.9, 1.3);

julia> gety(p)
1.3
source
DelaunayTriangulation.getxyFunction
getxy(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)
source
DelaunayTriangulation.is_point2Function
is_point2(p) -> Bool

Tests if p represents a point in the plane. By default, this returns the result of

eltype(p) <: Number && length(p) == 2
source
DelaunayTriangulation.getpointFunction
getpoint(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)
source
DelaunayTriangulation.get_pointFunction
get_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}}
source
DelaunayTriangulation.push_point!Function
push_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)
source
DelaunayTriangulation.pop_point!Function
pop_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)
source
DelaunayTriangulation.set_point!Function
set_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.0
source
DelaunayTriangulation.is_planarFunction
is_planar(points) -> Bool

Returns true if all points in points are two-dimensional. The default definition is simply all(is_point2, each_point(points)).

source

Edges

DelaunayTriangulation.construct_edgeFunction
construct_edge(::Type{E}, i, j) where {E} -> E

Construct 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
 15
source
DelaunayTriangulation.initialFunction
initial(e) -> Vertex

Get 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)
2
source
DelaunayTriangulation.terminalFunction
terminal(e) -> Vertex

Get 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)
13
source
DelaunayTriangulation.edge_verticesFunction
edge_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)
source
DelaunayTriangulation.reverse_edgeFunction
reverse_edge(e) -> Edge

Get 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
 1
source
DelaunayTriangulation.compare_unoriented_edgesFunction
compare_unoriented_edges(u, v) -> Bool

Compare 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)
true
source
DelaunayTriangulation.edge_typeFunction
edge_type(tri::Triangulation) -> DataType

Returns the type used for representing individual edges in tri.

source
edge_type(vorn::VoronoiTessellation) -> DataType

Type used for representing individual edges in the Voronoi tessellation.

source
edge_type(E) -> DataType

Get 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})
source
DelaunayTriangulation.contains_edgeFunction
contains_edge(i, j, E) -> Bool
contains_edge(e, E) -> Bool

Check 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)
true
source
DelaunayTriangulation.add_to_edges!Function
add_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)
source
DelaunayTriangulation.delete_from_edges!Function
delete_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]
source
DelaunayTriangulation.random_edgeFunction
random_edge([rng], E) -> E

Get 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)
source

Triangles

DelaunayTriangulation.construct_triangleFunction
construct_triangle(::Type{T}, i, j, k) where {T} -> Triangle

Construct 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
 3
source
DelaunayTriangulation.getiFunction
geti(T) -> Vertex

Get the first vertex of T.

Examples

julia> using DelaunayTriangulation

julia> DelaunayTriangulation.geti((1, 2, 3))
1

julia> DelaunayTriangulation.geti([2, 5, 1])
2
source
DelaunayTriangulation.getjFunction
getj(T) -> Vertex

Get the second vertex of T.

Examples

julia> using DelaunayTriangulation

julia> DelaunayTriangulation.getj((5, 6, 13))
6

julia> DelaunayTriangulation.getj([10, 19, 21])
19
source
DelaunayTriangulation.getkFunction
getk(T) -> Vertex

Get the third vertex of T.

Examples

julia> using DelaunayTriangulation

julia> DelaunayTriangulation.getk((1,2,3))
3

julia> DelaunayTriangulation.getk([1,2,3])
3
source
DelaunayTriangulation.triangle_verticesFunction
triangle_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)
source
DelaunayTriangulation.triangle_typeFunction
triangle_type(tri::Triangulation) -> DataType

Returns the type used for representing individual triangles in tri.

source
triangle_type(::InsertionEventHistory{T}) where {T} = T

Returns the type of the triangles in events, T.

source
triangle_type(vorn::VoronoiTessellation) -> DataType

Type used for representing individual triangles in the Voronoi tessellation.

source
triangle_type(::Type{T}) -> DataType

Get 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})
source
DelaunayTriangulation.triangle_edgesFunction
triangle_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))
source
DelaunayTriangulation.sort_triangleFunction
sort_triangle(T) -> Triangle
sort_triangle(i, j, k) -> Triangle

Sort 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)
source
DelaunayTriangulation.compare_trianglesFunction
compare_triangles(T, V) -> Bool

Compare 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)
false
source
DelaunayTriangulation.add_to_triangles!Function
add_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)
source
DelaunayTriangulation.delete_from_triangles!Function
delete_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)
source

Boundary Nodes

DelaunayTriangulation.num_boundary_edgesFunction
num_boundary_edges(boundary_nodes) -> Integer

Get the number of boundary edges in boundary_nodes, assuming that boundary_nodes defines a boundary with only one curve and a single section.

source
DelaunayTriangulation.each_boundary_nodeFunction
each_boundary_node(boundary_nodes) -> Iterator

Returns 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
source