Other Utilities

Here are some docstrings for other utility functions.

DelaunayTriangulation.get_boundary_indexFunction
get_boundary_index(i, j, k)
get_boundary_index(i, j)

Given three indices i, j, and k, returns the index corresponding to a boundary index. If no boundary index is provided, an ArgumentError is thrown. Similarly for the second method, which takes two indices.

DelaunayTriangulation.get_right_boundary_nodeMethod
get_right_boundary_node(adj::Adjacent{I,E}, k, boundary_index, boundary_index_ranges, check_existence::C) where {I,E,C}

Returns the node on the boundary that is to the right of k.

Arguments

  • adj::Adjacent: The Adjacent map.
  • k: The boundary node index.
  • boundary_index: The boundary index corresponding to the curve.
  • boundary_index_ranges: The boundary index ranges from construct_boundary_index_ranges.
  • check_existence::C: Whether to check over all boundary indices, in case there are multiple segments and thus multiple possible boundary indices on the boundary.

Outputs

  • i: The node on the boundary to the right of k.

See also get_left_boundary_node.

DelaunayTriangulation.get_left_boundary_nodeMethod
get_left_boundary_node(adj::Adjacent{I,E}, k, boundary_index, boundary_index_ranges, check_existence::C) where {I,E,C}

Returns the node on the boundary that is to the left of k.

Arguments

  • adj::Adjacent: The Adjacent map.
  • k: The boundary node index.
  • boundary_index: The boundary index corresponding to the curve.
  • boundary_index_ranges: The boundary index ranges from construct_boundary_index_ranges.
  • check_existence::C: Whether to check over all boundary indices, in case there are multiple segments and thus multiple possible boundary indices on the boundary.

Outputs

  • i: The node on the boundary to the left of k.

See also get_right_boundary_node.

DelaunayTriangulation.find_edgeMethod
find_edge(T, points, ℓ)

Given a triangle T with indices corresponding to points, returns the edge of T that contains the point . It is assumed that the point is on an edge of T. If this is not the case, an error is thrown.

DelaunayTriangulation.choose_uvwFunction
choose_uvw(e1, e2, e3, u, v, w)

Choose values for (u, v, w) based on the Booleans (e1, e2, e3), assuming only one is true. The three cases are:

  • If e1, returns (u, v, w).
  • If e2, returns (v, w, u).
  • If e3, returns (w, u, v).
DelaunayTriangulation.circular_equalityFunction
circular_equality(A, B, by = isequal)

Tests if the arrays A and B are equal up to a circular shift, assuming A and B are circular. The function by is used to test equality of elements.

DelaunayTriangulation.get_surrounding_polygonMethod
get_surrounding_polygon(adj::Adjacent{I,E}, graph::Graph, u, boundary_index_ranges, check_existence::C; skip_boundary_indices=false) where {I,E,C}

Given a point u, returns a vector S which gives a counter-clockwise sequence of the neighbours of u.

Arguments

  • adj::Adjacent{I,E}: The Adjacent map.
  • graph::Graph: The Graph.
  • u: The vertex.
  • boundary_index_ranges: The output of construct_boundary_index_ranges.
  • check_existence::C: Whether to check over all boundary indices, in case there are multiple segments and thus multiple possible boundary indices on the boundary.

Keyword Arguments

  • skip_boundary_indices=false: Whether to remove all boundary indices from the result at the end.

Outputs

  • S: The surrounding polygon.
Note
  • When u is an outer boundary index, the returned polygon is clockwise.
  • When u is a boundary vertex and you do not have ghost triangles, then this function may return an invalid polygon.
DelaunayTriangulation.sort_edge_by_degreeMethod
sort_edge_by_degree(e::E, graph::Graph)

Given an edge e of a graph, say e = (u, v), returns:

  • If deg(u) ≤ deg(v), returns e;
  • If deg(u) > deg(v), returns (v, u).

In particular, e is sorted so that initial(e) is the vertex of e with the smallest degree.

DelaunayTriangulation.split_constrained_edge!Method
split_constrained_edge!(constrained_edges, constrained_edge::E, collinear_segments) where {E}

Splits the constrained_edge at the segments in collinear_segments, updating constrained_edges accordingly.

DelaunayTriangulation.fix_segments!Method
fix_segments!(segments::AbstractVector{E}, bad_indices) where {E}

Fixes the overlapping segments in segments, referred to via bad_indices.

Example

For example, if we had

julia> c = [(2, 15), (2, 28), (2, 41)]

then these edges come from connecting the start of a constrained segment with a point that it goes through, but they are not actual segments in the triangulation (because they all start with 2). So, using bad_indices = [1, 2, 3], the function mutates c to give

julia> bad_indices = [1, 2, 3]
julia> fix_segments!(c, bad_indices)
julia> c
3-element Vector{Tuple{Int, Int}}:
 (2, 15)
 (15, 28)
 (28, 41)
DelaunayTriangulation.connect_segments!Method
connect_segments!(segments::AbstractVector{E}) where {E}

Given an ordered vector of segments, mutates so that the endpoints connect, preserving order.

Example

julia> C = [(7, 12), (12, 17), (17, 22), (32, 37), (37, 42), (42, 47)];

julia> DelaunayTriangulation.connect_segments!(C);

julia> C
7-element Vector{Tuple{Int, Int}}:
 (7, 12)
 (12, 17)
 (17, 22)
 (32, 37)
 (37, 42)
 (42, 47)
 (22, 32)
DelaunayTriangulation.extend_segments!Method
extend_segments!(segments::AbstractVector{E}, constrained_edge) where {E}

Given an ordered vector of segments, ensures that they also represent the replacement of constrained_edge.

Example

julia> segments = [(2, 7), (7, 12), (12, 49)];
julia> constrained_edge = (1, 68);
julia> extend_segments!(segments, constrained_edge);
julia> segments
5-element Vector{Tuple{Int, Int}}:
 (1, 2)
 (2, 7)
 (7, 12)
 (12, 49)
 (49, 68)
DelaunayTriangulation.convert_boundary_points_to_indicesMethod
convert_boundary_points_to_indices(x, y; existing_points = NTuple{2, Float64}[], check_args=true, adjust=true)
convert_boundary_points_to_indices(xy; existing_points = NTuple{2, Float64}[], check_args=true, adjust=true)

Given some points (x, y) representing a boundary, or xy giving the points combined rather than separated, converts their representation into a set of indices corresponding to each boundary. The points should match the specification of a boundary defined in the documentation. These points also get appended onto the set of points given by the existing_points keyword argument, which should be used if you have a pre-existing set of points.

The returned value is (nodes, points), with nodes the indices and points the modified existing_points (which are mutated in-place also).

DelaunayTriangulation.get_ordinal_suffixFunction
get_ordinal_suffix(i)

Returns the ordinal suffix for the given integer i.

Example

julia> get_ordinal_suffix(1)
"st"
julia> get_ordinal_suffix(2)
"nd"
julia> get_ordinal_suffix(3)
"rd"    
julia> get_ordinal_suffix(4)
"th"
julia> get_ordinal_suffix(11)
"th"
DelaunayTriangulation.check_argsFunction
check_args(points, boundary_nodes)

Checks the arguments points and boundary_nodes to make sure that they are valid. If they are not, an error is thrown. This function is called by triangulate if the check_args keyword argument is set to true. If you are sure that your arguments are valid, you can set this keyword argument to false to speed up the triangulation process.

DelaunayTriangulation.min_med_maxFunction
min_med_max(a, b, c)

Returns (min(a, b, c), med(a, b, c), max(a, b, c)), wheremed(a, b, c)is the value that is neithermin(a, b, c)ormax(a, b, c)`.

DelaunayTriangulation.segment_vertices_adjoin_other_segmentsFunction
segment_vertices_adjoin_other_segments(tri::Triangulation, e)

Test if the segment e's vertices adjoin other segments. Returns:

  • 0: No vertex adjoins another segment.
  • 1: One vertex adjoins another segment.
  • 2: Both vertices adjoin another segment.
DelaunayTriangulation.edge_lies_on_two_distinct_segmentsFunction
edge_lies_on_two_distinct_segments(tri::Triangulation, e)

Tests if the edge (i, j) lies on two distinct segments. The returned value is:

  • (true, common_vertex): If e lies on two distinct segments, and the common vertex is common_vertex.
  • (false, 0): Otherwise.

If there are multiple common vertices. In this case, the function returns the vertex that is closest to e.

Missing docstring.

Missing docstring for convert_to_boundary_index. Check Documenter's build log for details.

Missing docstring.

Missing docstring for get_neighbouring_boundary_edges. Check Documenter's build log for details.

DelaunayTriangulation.previndex_circularFunction
previndex_circular(C, i)

Returns the previous index in the collection C before i, wrapping around to the second-last index if i is the first index, assuming that is_circular(C) so that C[begin] == C[end].

Missing docstring.

Missing docstring for is_first_boundary_index. Check Documenter's build log for details.

Missing docstring.

Missing docstring for is_last_boundary_index. Check Documenter's build log for details.

Missing docstring.

Missing docstring for get_neighbouring_boundary_edges. Check Documenter's build log for details.

DelaunayTriangulation.convert_to_boundary_edgeFunction
convert_to_boundary_edge(vorn::VoronoiTessellation, e)

Converts the edge e in the triangulation of vorn to a boundary edge so that get_adjacent(vorn, e) is a boundary index.

convert_to_boundary_edge(tri::Triangulation, e)

Given an edge e, returns the edge that is on the boundary, oriented so that get_adjacent(tri, v) is a boundary index, where v is the edge returned.

Missing docstring.

Missing docstring for get_shared_vertex. Check Documenter's build log for details.

DelaunayTriangulation.iterated_neighbourhoodFunction
iterated_neighbourhood(tri, i, d)

Computes the d-times iterated neighbourhood of i in the triangulation tri. In particular, this returns all indices that are within d edges of i, excluding i itself.