DiscreteVoronoi.EarlyStopper
— TypeEarlyStopper{T}
A simple container that contains information about how far to iterate through the object.
DiscreteVoronoi.dac_voronoi!
— Methoddac_voronoi!(grid::Matrix{T}, sites::Vector{T}; distance=euclidean) where {T<:SVector{2,Int}}
Construct in-place a Voronoi diagram using the divide-and-conquer algorithm.
DiscreteVoronoi.early_stop_sort!
— Methodearly_stop_sort!(early_stopper::ES, predicate::F)::ES where {ES<:EarlyStopper, F<:Function}
Sorts `early_stopper.obj` based on `predicate` and returns an `EarlyStopper` of the same type
that contains updated `stop_at` information. The sorting is unstable.
DiscreteVoronoi.find_closest_site
— Methodfind_closest_site(cell, sites; distance=euclidean)
Returns the closest site to cell
in sites
determined by distance
.
DiscreteVoronoi.get_corners
— Methodget_corners(TL, BR)
Returns the corners of the rectangle defined by its top-left (TL) and bottom-right (BR) corners
DiscreteVoronoi.get_quadrants
— Methodget_quadrants(TL, BR)
Returns a tuple containing top-left (TL) and bottom-right (BR) corners for each quadrant of input TL-BR
DiscreteVoronoi.jfa_voronoi!
— Methodjfa_voronoi!(grid::Matrix{T}, sites::Vector{T}; distance=euclidean) where {T<:SVector{2,Int}}
Construct in-place a Voronoi diagram using the jump flooding algorithm. The algorithm assumes that a blank cell in the grid has value SVector(0, 0)
and that sites are inside the grid.
DiscreteVoronoi.label_voronoi_grid
— Methodlabel_voronoi_grid(grid; shuffle_cells=true)
Given a grid of un-plottable things, it assigns each unique value in the grid a number to plot. shuffle_cells
determines whether the assigned values are randomly shuffled before assignment. If they're not you might get a pretty gradient or other pattern :)
DiscreteVoronoi.naive_voronoi!
— Methodnaive_voronoi!(grid::Matrix{T}, sites::Vector{T}; distance=euclidean) where {T<:SVector{2,Int}}
Construct in-place a Voronoi diagram in the most basic way possible: check every cell and every combination.
DiscreteVoronoi.redac_voronoi!
— Methodredac_voronoi!(grid::Matrix{T}, sites::Vector{T}; distance=euclidean, auxiliary=exact_aux) where {T<:SVector{2,Int}}
Performs a divide-and-conquer method similar to dac_voronoi!
but has an additional site-elimination step which aims to reduce the work of subsequent steps.
DiscreteVoronoi.swap!
— Methodswap!(v, i::Int, j::Int)
Swap (in-place) the elements of v
indexed by i
and j
. Does nothing if i == j
.
DiscreteVoronoi.voronoi_equality
— Methodvoronoi_equality(grid1, grid2; distance=euclidean)
Checks equality of Voronoi diagrams accounting for the fact that there may be multiple correct/equivalent solutions as some sites may be the same distance from some cells.