| framedist.pixels | R Documentation |
Computes the distances from each pixel to the bounding rectangle.
framedist.pixels(w, ..., style=c("image", "matrix", "coords"))
w |
A window (object of class |
... |
Arguments passed to |
style |
Character string (partially matched) determining the format of
the output: either |
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.
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.
and \rolf
bdist.pixels.
opa <- par(mfrow=c(1,2))
plot(framedist.pixels(letterR))
plot(bdist.pixels(letterR))
par(opa)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.