project2set | R Documentation |
For each data point in a point pattern X
,
find the nearest location in a given spatial region W
.
project2set(X, W, ...)
X |
Point pattern (object of class |
W |
Window (object of class |
... |
Arguments passed to |
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]
.
A point pattern (object of class "ppp"
) with the same
number of points as X
in the window W
.
and \ege
project2segment
,
nncross
He <- heather$fine[owin(c(2.8, 7.4), c(4.0, 7.8))]
plot(He, main="project2set")
W <- erosion(complement.owin(He), 0.2)
if(require(spatstat.random)) {
X <- runifpoint(4, W)
} else {
X <- ppp(c(6.1, 4.3, 5.7, 4.7), c(5.0, 6.6, 7.5, 4.9), window=W)
}
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.