framedist.pixels {spatstat.geom} | R 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 |
... |
Arguments passed to |
style |
Character string (partially matched) determining the format of
the output: either |
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 Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner rolfturner@posteo.net
See Also
Examples
opa <- par(mfrow=c(1,2))
plot(framedist.pixels(letterR))
plot(bdist.pixels(letterR))
par(opa)