voronoiPolygons(): Tiles, Triangles and Polygons

lindbrook

2019-08-27

voronoiPolygons() is a wrapper function that extracts the vertices of ‘deldir’ Delauny triangles and Dirichelet (Voronoi) tiles for use with functions like graphics::polygon(). The function returns a list of data frames of vertices. This makes tasks like coloring tiles or triangles or counting cases within those tiles or triangles easier.

The functions has four arguments. sites is the data frame of the sites or focal points used to do the tessellation or triangulation. rw.data (rw = ‘rectangular window’) is the data frame of a secondary source data (e.g., fatalities, customers, etc.). This argument is useful when the range of secondary data exceeds that of the sites data. rw is the deldir way to specify the range of data. It uses a vector of the corners of the rectangular window: xmin, xmax, ymin, ymax. type is “tiles” or “triangles”.

To color tiles and triangles or to count the number of points (e.g., fatalities) within each tile or triangle, we can apply sp::point.in.polygon() to the results of voronoiPolygons().