voronoiPolygons {cholera} R Documentation

## Extract vertices of Delauny triangles and Dirichelet (Voronoi) tiles.

### Description

For construction and plotting of Delauny and Voronoi polygons.

### Usage

```voronoiPolygons(sites, rw.data = NULL, rw = NULL, type = "tiles",
output = "vertices")
```

### Arguments

 `sites` Object. Data frame of sites to compute Delauny triangulation and Dirichelet (Voronoi) tessellation with variables "x" and "y". `rw.data` Object. Data frame of secondary source of data to set the rectangular window or bounding box: observations, cases, etc. with variables "x" and "y". `rw` Numeric. Alternative to rw.data: vector of corners to define the rectangular window or bounding box: xmin, xmax, ymin, ymax. `type` Character. "tiles" (tessellation) or "triangles" (triangulation) vertices. `output` Character. "vertices" or "polygons". "vertices" re "polygons" will draw base R polygons() to an existing plot.

### Value

An R list of data frames or base R graphics polygon()'s'.

### Note

This function relies on the 'deldir' package.

### Examples

```snowMap()
voronoiPolygons(pumps, output = "polygons")

snowMap()
voronoiPolygons(pumps, roads, output = "polygons")

snowMap()
voronoiPolygons(pumps, roads, type = "triangles", output = "polygons")

vertices <- voronoiPolygons(pumps, roads)
snow.colors <- grDevices::adjustcolor(snowColors(), alpha.f = 1/3)
snowMap(add.cases = FALSE)
invisible(lapply(seq_along(vertices), function(i) {
polygon(vertices[[i]], col = snow.colors[[i]])
}))
```

[Package cholera version 0.7.5 Index]