Learn R Programming

spatstat.geom (version 3.2-5)

periodify: Make Periodic Copies of a Spatial Pattern

Description

Given a spatial pattern (point pattern, line segment pattern, window, etc) make shifted copies of the pattern and optionally combine them to make a periodic pattern.

Usage

periodify(X, ...)
# S3 method for ppp
periodify(X, nx = 1, ny = 1, ...,
           combine=TRUE, warn=TRUE, check=TRUE,
           ix=(-nx):nx, iy=(-ny):ny,
           ixy=expand.grid(ix=ix,iy=iy))
# S3 method for psp
periodify(X, nx = 1, ny = 1, ..., 
           combine=TRUE, warn=TRUE, check=TRUE,
           ix=(-nx):nx, iy=(-ny):ny, 
           ixy=expand.grid(ix=ix,iy=iy))
# S3 method for owin
periodify(X, nx = 1, ny = 1, ...,
           combine=TRUE, warn=TRUE, 
           ix=(-nx):nx, iy=(-ny):ny,
           ixy=expand.grid(ix=ix,iy=iy))

Value

If combine=TRUE, an object of the same class as X. If combine=FALSE, a list of objects of the same class as X.

Arguments

X

An object representing a spatial pattern (point pattern, line segment pattern or window).

nx,ny

Integers. Numbers of additional copies of X in each direction. The result will be a grid of 2 * nx + 1 by 2 * ny + 1 copies of the original object. (Overruled by ix, iy, ixy).

...

Ignored.

combine

Logical flag determining whether the copies should be superimposed to make an object like X (if combine=TRUE) or simply returned as a list of objects (combine=FALSE).

warn

Logical flag determining whether to issue warnings.

check

Logical flag determining whether to check the validity of the combined pattern.

ix, iy

Integer vectors determining the grid positions of the copies of X. (Overruled by ixy).

ixy

Matrix or data frame with two columns, giving the grid positions of the copies of X.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz

Details

Given a spatial pattern (point pattern, line segment pattern, etc) this function makes a number of shifted copies of the pattern and optionally combines them. The function periodify is generic, with methods for various kinds of spatial objects.

The default is to make a 3 by 3 array of copies of X and combine them into a single pattern of the same kind as X. This can be used (for example) to compute toroidal or periodic edge corrections for various operations on X.

If the arguments nx, ny are given and other arguments are missing, the original object will be copied nx times to the right and nx times to the left, then ny times upward and ny times downward, making (2 * nx + 1) * (2 * ny + 1) copies altogether, arranged in a grid, centred on the original object.

If the arguments ix, iy or ixy are specified, then these determine the grid positions of the copies of X that will be made. For example (ix,iy) = (1, 2) means a copy of X shifted by the vector (ix * w, iy * h) where w,h are the width and height of the bounding rectangle of X.

If combine=TRUE (the default) the copies of X are superimposed to create an object of the same kind as X. If combine=FALSE the copies of X are returned as a list.

See Also

shift

Examples

Run this code
  plot(periodify(cells))
  a <- lapply(periodify(Window(cells), combine=FALSE),
        plot, add=TRUE,lty=2)

Run the code above in your browser using DataLab