# NOT RUN {
w <- unit.square()
xy <- stratrand(w, 10, 10)
# plot(w)
# points(xy)
# polygonal boundary
bdry <- list(x=c(0.1,0.3,0.7,0.4,0.2),
y=c(0.1,0.1,0.5,0.7,0.3))
w <- owin(c(0,1), c(0,1), poly=bdry)
xy <- stratrand(w, 10, 10, 3)
# plot(w)
# points(xy)
# determine which grid points are inside polygon
ok <- inside.owin(xy$x, xy$y, w)
# plot(w)
# points(xy$x[ok], xy$y[ok])
# }
Run the code above in your browser using DataLab