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
in the rectangular frame
Frame(w)
, the shortest distance
to the boundary of .
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 coordinate and columns to the
coordinate.
If style="coords"
, a list with three components
x,y,z
, where x,y
are vectors of length
giving the
and
coordinates respectively,
and
z
is an 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
coordinate and columns to the
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)