Learn R Programming

spatstat (version 1.60-1)

covering: Cover Region with Discs

Description

Given a spatial region, this function finds an efficient covering of the region using discs of a chosen radius.

Usage

covering(W, r, …, giveup=1000)

Arguments

W

A window (object of class "owin").

r

positive number: the radius of the covering discs.

extra arguments passed to as.mask controlling the pixel resolution for the calculations.

giveup

Maximum number of attempts to place additional discs.

Value

A point pattern (object of class "ppp") giving the centres of the discs.

Details

This function finds an efficient covering of the window W using discs of the given radius r. The result is a point pattern giving the centres of the discs.

The algorithm tries to use as few discs as possible, but is not guaranteed to find the minimal number of discs. It begins by placing a hexagonal grid of points inside W, then adds further points until every location inside W lies no more than r units away from one of the points.

Examples

Run this code
# NOT RUN {
  rr <- 0.5
  X <- covering(letterR, rr)
  plot(grow.rectangle(Frame(X), rr), type="n", main="")
  plot(X, pch=16, add=TRUE, col="red")
  plot(letterR, add=TRUE, lwd=3)
  plot(X %mark% (2*rr), add=TRUE, markscale=1)
# }

Run the code above in your browser using DataLab