Apollonius {Apollonius}R Documentation

Apollonius diagram and Apollonius graph

Description

Computation of the Apollonius diagram and the Apollonius graph of some weighted 2D points. The Apollonius graph is the dual of the Apollonius diagram. It is also called the additively weighted Voronoï diagram.

Usage

Apollonius(sites, radii, tmax = 30, nsegs = 100L, nrays = 300L)

Arguments

sites

the 2D points, a numeric matrix with two columns (one point per row)

radii

the weights, a numeric vector of length equal to the number of points (i.e. the number of rows of sites)

tmax

a positive number passed to gyroray, controlling the length of the infinite edges (i.e. the hyperbolic rays) of the Apollonius graph

nsegs

a positive integer, the desired number of points of each finite edge of the Apollonius graph

nrays

a positive integer, the desired number of points of each infinite edge of the Apollonius graph

Details

See the CGAL documentation.

Value

A list with two fields diagram and graph. The diagram field is a list providing the sites and the faces of the Apollonius diagram. The graph field is a list providing the sites and the edges of the Apollonius graph.

Examples

library(Apollonius)
sites <- rbind(
  c(0, 0),
  c(4, 1),
  c(2, 4),
  c(7, 4),
  c(8, 0),
  c(5, -2),
  c(-4, 4),
  c(-2, -1),
  c(11, 4),
  c(11, 0)
)
radii <- c(1, 1.5, 1.25, 2, 1.75, 0.5, 0.4, 0.6, 0.7, 0.3)
apo <- Apollonius(sites, radii)
opar <- par(mar = c(4, 4, 1, 1))
plotApolloniusGraph(apo, xlab = "x", ylab = "y")
par(opar)

# Example of a non-valid graph ####
library(Apollonius)
sites <- rbind(
  c(-1, -1),
  c(-1, 1),
  c(1, 1),
  c(1, -1),
  c(0, 0)
)
angle_ <- seq(0, 2*pi, length.out = 13L)[-1L]
circle <- cbind(2 * cos(angle_), 2 * sin(angle_))
sites <- rbind(sites, circle)
radii <- c(rep(2, 5), rep(1, 12))
## Not run: apo <- Apollonius(sites, radii)

[Package Apollonius version 1.0.1 Index]