distfun {spatstat} | R Documentation |
Compute the distance function of an object, and return it as a function.
distfun(X, ...) ## S3 method for class 'ppp' distfun(X, ...) ## S3 method for class 'psp' distfun(X, ...) ## S3 method for class 'owin' distfun(X, ..., invert=FALSE)
X |
Any suitable dataset representing a two-dimensional
object, such as a point pattern (object of class |
... |
Extra arguments are ignored. |
invert |
If |
The “distance function” of a set of points A is the
mathematical function f such that, for any
two-dimensional spatial location (x,y),
the function value f(x,y)
is the shortest distance from (x,y) to A.
The command f <- distfun(X)
returns a function
in the R language, with arguments x,y
, that represents the
distance function of X
. Evaluating the function f
in the form v <- f(x,y)
, where x
and y
are any numeric vectors of equal length containing coordinates of
spatial locations, yields the values of the distance function at these
locations.
This should be contrasted with the related command distmap
which computes the distance function of X
on a grid of locations, and returns the distance
values in the form of a pixel image.
A distfun
object can be converted to a pixel image
using as.im
.
A function
with arguments x,y
.
The function also belongs to the class "distfun"
for which
there are methods for print
, plot
,
contour
and persp
.
Adrian Baddeley Adrian.Baddeley@csiro.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz
data(letterR) f <- distfun(letterR) f(0.2, 0.3)