Learn R Programming

tripack (version 1.3-4)

cells: extract info about voronoi cells

Description

This function returns some info about the cells of a voronoi mosaic, including the coordinates of the vertices and the cell area.

Usage

cells(voronoi.obj)

Arguments

voronoi.obj
object of class voronoi

Value

  • retruns a list of lists, one entry for each voronoi cell which contains
  • cellcell index
  • centercell 'center'
  • neighboursneighbour cell indices
  • nodes2 times nnb matrix with vertice coordinates
  • areacell area

Details

The function calculates the neighbourhood relations between the underlying triangulation and translates it into the neighbourhood relations between the voronoi cells.

See Also

voronoi.mosaic, voronoi.area

Examples

Run this code
data(tritest)
tritest.vm <- voronoi.mosaic(tritest$x,tritest$y)
tritest.cells <- cells(tritest.vm)
# higlight cell 12:
plot(tritest.vm)
polygon(t(tritest.cells[[12]]$nodes),col="green")
# put cell area into cell center:
text(tritest.cells[[12]]$center[1],
     tritest.cells[[12]]$center[2],
     tritest.cells[[12]]$area)

Run the code above in your browser using DataLab