framedist.pixels: Distance to Bounding Frame

View source: R/distbdry.R

framedist.pixelsR Documentation

Distance to Bounding Frame

Description

Computes the distances from each pixel to the bounding rectangle.

Usage

 framedist.pixels(w, ..., style=c("image", "matrix", "coords"))

Arguments

w

A window (object of class "owin").

...

Arguments passed to as.mask to determine the pixel resolution.

style

Character string (partially matched) determining the format of the output: either "matrix", "coords" or "image".

Details

This function computes, for each pixel u in the rectangular frame Frame(w), the shortest distance to the boundary of Frame(w).

The grid of pixels is determined by the arguments "\dots" passed to as.mask. The distance from each pixel to the boundary is calculated exactly, using analytic geometry.

Value

If style="image", a pixel image (object of class "im") containing the distances from each pixel in the image raster to the boundary of the window.

If style="matrix", a matrix giving the distances from each pixel in the image raster to the boundary of the window. Rows of this matrix correspond to the y coordinate and columns to the x coordinate.

If style="coords", a list with three components x,y,z, where x,y are vectors of length m,n giving the x and y coordinates respectively, and z is an m \times n matrix such that z[i,j] is the distance from (x[i],y[j]) to the boundary of the window. Rows of this matrix correspond to the x coordinate and columns to the y coordinate. This result can be plotted with persp, image or contour.

Author(s)

\adrian

and \rolf

See Also

bdist.pixels.

Examples

  opa <- par(mfrow=c(1,2))
  plot(framedist.pixels(letterR))
  plot(bdist.pixels(letterR))
  par(opa)

spatstat.geom documentation built on Oct. 20, 2023, 9:06 a.m.