Skip to contents

Returns one multilinestring per input geometry, whose parts are the boundaries between that geometry's Voronoi cells. ga_voronoi_edges() preserves the input's length.

Usage

ga_voronoi_edges(geometry, clip = "padded", tolerance = 0, boundary = NULL)

Arguments

geometry

a GeoArrow geometry array whose vertices are the sites

clip

how to bound the diagram, either "padded" or "envelope". Has no effect when you supply boundary

tolerance

the distance below which to snap sites to the same position; length 1 or the same length as geometry

boundary

an optional GeoArrow polygon array to clip to; length 1 or the same length as geometry

Value

a GeoArrow multilinestring array of the same length as geometry

Details

Unlike ga_voronoi_cells(), this works on collinear sites, where the edges are the perpendicular bisectors between neighbouring points. Prefer it when you want the diagram's skeleton rather than closed regions.

A geometry with fewer than two distinct vertices has no edges, and ga_voronoi_edges() returns an empty multilinestring for it. It keeps a null geometry null.

References

Voronoi

See also

Other voronoi: ga_voronoi_cells()

Examples

pts <- sf::st_multipoint(cbind(c(0, 1, 1, 0), c(0, 0, 1, 1)))
g <- geoarrow::as_geoarrow_array(sf::st_sfc(pts))

sf::st_as_sfc(geoarrow::as_geoarrow_vctr(ga_voronoi_edges(g)))
#> Geometry set for 1 feature 
#> Geometry type: MULTILINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -0.5 ymin: -0.5 xmax: 1.5 ymax: 1.5
#> CRS:           NA
#> MULTILINESTRING ((0.5 0.5, 0.5 -0.5), (0.5 0.5,...