View source: R/plot_apollonius.R
plot_apollonius | R Documentation |
Plots the Apollonius diagram, a.k.a. (additively) weighted Voronoi diagram, based on a matrix of points (centers) in 2d and their weights.
plot_apollonius(
points,
weights,
show_points = TRUE,
show_weights = TRUE,
add_to_weights = 0,
add = FALSE,
col = 4,
lwd = 1.5,
...
)
points |
A two-column matrix containing the 2d points. |
weights |
A vector of weights for the points. |
show_points |
Logical. Should the points be displayed in the plot? Defaults to TRUE. |
show_weights |
Logical. Should the weights be displayed in the plot? Defaults to TRUE. |
add_to_weights |
A value added to the weights to make the plot more informative. |
add |
Logical. Should the plot be added to the current device? Defaults to FALSE. |
col |
The colour for the cell boundaries. |
lwd |
The line width for the cell boundaries. |
... |
Further parameters to the base plot if |
For points x_1, \ldots, x_n
with weights w_1, \ldots, w_n
The $i$-th cell of the Apollonius diagram contains all the points x that satisfy
\|x-x_i\|-w_i < \|x-x_j\|-w_j
for all j \neq i
. Its boundaries are hyperbola segments.
If show_weights
is TRUE
, grey circles of radii weights + add_to_weights
are plotted around the points. Negative radii are set to zero.
This function requires the Computational Geometry Algorithms Library (CGAL), available at https://www.cgal.org. Adapt the file src/Makevars according to the instructions given there and re-install from source.
Valentin Hartmann valentin.hartmann@epfl.ch (most of the code)
Dominic Schuhmacher schuhmacher@math.uni-goettingen.de (R-port)
Menelaos Karavelas and Mariette Yvinec. 2D Apollonius Graphs (Delaunay Graphs of Disks). In CGAL User and Reference Manual. CGAL Editorial Board, 4.12 edition, 2018
## Not run:
w <- c(0.731, 0.0372, 0.618, 0.113, 0.395, 0.222, 0.124, 0.101, 0.328, 0)
points <- matrix(runif(20), 10, 2)
plot_apollonius(points, w, add_to_weights = -0.1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.