# distmap.ppp

##### Distance Map of Point Pattern

Computes the distance from each pixel to the nearest point in the given point pattern.

- Keywords
- spatial

##### Usage

`distmap.ppp(X, ...)`

##### Arguments

- X
- A point pattern (object of class
`"ppp"`

). - ...
- Arguments passed to
`as.mask`

to control pixel resolution.

##### Details

The ``distance map'' of a point pattern $X$ is the function
$f$ whose value `f(u)`

is defined for any two-dimensional
location $u$ as the shortest distance from $u$ to $X$.

This function computes the distance map of the point pattern `X`

and returns the distance map as a pixel image. The greyscale value
at a pixel $u$ equals the distance from $u$ to the nearest
point of the pattern `X`

.

Additionally, the return value
has two attributes, `"index"`

and `"bdry"`

, which are
also pixel images. The grey values in `"bdry"`

give the
distance from each pixel to the bounding rectangle of the image.
The grey values in `"index"`

are integers identifying which
point of `X`

is closest.
This is a method for the generic function `distmap`

.

##### Value

- A pixel image (object of class
`"im"`

) whose greyscale values are the values of the distance map. The return value has attributes`"index"`

and`"bdry"`

which are also pixel images.

##### See Also

##### Examples

```
data(cells)
U <- distmap(cells)
plot(U)
plot(attr(U, "bdry"))
plot(attr(U, "index"))
```

*Documentation reproduced from package spatstat, version 1.6-11, License: GPL version 2 or newer*