Distance Map as a Function
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)
- Any suitable dataset representing a two-dimensional
object, such as a point pattern (object of class
"ppp"), a window (object of class
"owin") or a line segment pattern (object of class
- Extra arguments are ignored.
TRUE, compute the distance transform of the complement of
is the shortest distance from $(x,y)$ to $A$.
f <- distfun(X) returns a function
in the Rlanguage, with arguments
x,y, that represents the
distance function of
X. Evaluating the function
in the form
v <- f(x,y), where
are any numeric vectors of equal length containing coordinates of
spatial locations, yields the values of the distance function at these
This should be contrasted with the related command
which computes the distance function of
on a grid of locations, and returns the distance
values in the form of a pixel image.
The result of
f <- distfun(X) also belongs to the class
"funxy" and to the special class
It can be printed and plotted immediately as shown in the Examples.
distfun object can be converted to a pixel image
x,y. The function also belongs to the class
"distfun"which has a method for
"funxy"which has methods for
data(letterR) f <- distfun(letterR) f plot(f) f(0.2, 0.3)