data(demopat)
X <- demopat
plot(X, main="original pattern")
Y <- discretise(X, dimyx=50)
plot(Y, main="discretise(X)")
stopifnot(X$n == Y$n)
# what happens if we just convert the window to a mask?
W <- X$window
M <- as.mask(W, dimyx=50)
plot(M, main="window of X converted to mask")
plot(X, add=TRUE, pch=16)
plot(X[M], add=TRUE, pch=1, cex=1.5)
XM <- X[M]
cat(paste(X$n - XM$n, "points of X lie outside M
"))
Run the code above in your browser using DataLab