# project2set

From spatstat v1.63-0
by Adrian Baddeley

##### Find Nearest Point in a Region

For each data point in a point pattern `X`

,
find the nearest location in a given spatial region `W`

.

##### Usage

`project2set(X, W, …)`

##### Arguments

##### Details

The window `W`

is first discretised as a binary mask
using `as.mask`

.

For each data point `X[i]`

in the point pattern `X`

,
the algorithm finds the nearest pixel in `W`

.

The result is a point pattern `Y`

containing these nearest points,
that is, `Y[i]`

is the nearest point in `W`

to the
point `X[i]`

.

##### Value

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

) with the same
number of points as `X`

in the window `W`

.

##### See Also

##### Examples

```
# NOT RUN {
He <- heather$fine[owin(c(2.8, 7.4), c(4.0, 7.8))]
plot(He, main="project2set")
X <- runifpoint(4, erosion(complement.owin(He), 0.2))
points(X, col="red")
Y <- project2set(X, He)
points(Y, col="green")
arrows(X$x, X$y, Y$x, Y$y, angle=15, length=0.2)
# }
```

*Documentation reproduced from package spatstat, version 1.63-0, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.