Compute a voronoi tesselation of a map for a set of points.

voronoi(x, ext, eps = 1e-09)

Arguments

x

sf POINTS or two-column matrix or data.frame with x and y coordinates.

ext

Extent object.

eps

Numerical tolerance used in triangulation. See deldir.

Value

sf POLYGON object.

Author

Borrowed from function voronoi from package dismo by R. Hijmans et al., which ultimately uses the deldir function by Rolf Turner.

Examples

  pts <- data.frame(x = c(1:2, 2), y = c(1, 1:2))
  region <- terra::ext(c(0, 3, 0, 3))
  plot(sf::st_geometry(voronoi(pts, region)))
  points(pts)