Learn R Programming

deldir (version 0.1-9)

tilePerim: Calculate tile perimeters.

Description

Calculates the perimeters of all of the Dirichlet (Voronoi) tiles in a tessellation of a set of planar points. Also calculates the sum and the mean of these perimeters.

Usage

tilePerim(object,inclbdry=TRUE)

Arguments

object
An object of class tile.list (as produced by tile.list() specifying the Dirichlet (Voronoi) tiles in a tessellation of a set of planar points.
inclbdry
Logical scalar. Should boundary segments (edges of tiles at least one of whose endpoints lies on the enclosing rectangle rw (see deldir()) be included in the perimeter?

Value

  • A list with components
  • perimetersA vector consisting of the values of the perimeters of the Dirichlet tiles in the tessellation.
  • totalPerimThe sum of perimeters.
  • meanPerimThe mean of perimeters.

See Also

tile.list(), plot.tile.list()

Examples

Run this code
x <- runif(20)
    y <- runif(20)
    z <- deldir(x,y,rw=c(0,1,0,1))
    w <- tile.list(z)
    p1 <- tilePerim(w)
    p0 <- tilePerim(w,inclbdry=FALSE)
    p1$totalPerim - p0$totalPerim # Get 4 = the perimeter of rw.
    ss <- apply(as.matrix(z$dirsgs[,1:4]),1,
                function(x){(x[1]-x[3])^2 + (x[2]-x[4])^2})
    2*sum(sqrt(ss)) - p0$totalPerim # Get 0; in tilePerim() each interior
                                    # edge is counted twice.

Run the code above in your browser using DataLab