covering: Cover Region with Discs

View source: R/covering.R

coveringR Documentation

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.

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.

Value

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

Author(s)

\adrian

Examples

  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)

spatstat.geom documentation built on Sept. 18, 2024, 9:08 a.m.