set.seed(42)
x <- runif(20)
y <- runif(20)
z <- deldir(x,y)
w <- tile.list(z)
z <- deldir(x,y,rw=c(0,1,0,1))
w <- tile.list(z)
z <- deldir(x,y,rw=c(0,1,0,1),dpl=list(ndx=2,ndy=2))
w <- tile.list(z)
if(require(polyclip)) {
CP <- list(x=c(0.49,0.35,0.15,0.20,0.35,0.42,
0.43,0.62,0.46,0.63,0.82,0.79),
y=c(0.78,0.86,0.79,0.54,0.58,0.70,
0.51,0.46,0.31,0.20,0.37,0.54))
wc <- tile.list(z,clipp=CP) # 10 tiles are retained; the third tile,
# corresponding to point 6, is
# subdivided into two parts.
# Determine the tiles on the border of a clipping region.
# Example due to Huimin Wang.
set.seed(112)
x <- runif(100)
y <- runif(100)
dxy <- deldir(x,y)
txy <- tile.list(dxy)
chind <- chull(x,y)
bdry <- list(x=x[chind],y=y[chind])
ctxy <- tile.list(dxy,clipp=bdry)
inside <- lapply(ctxy,function(tile,bdry){insidePoly(tile$x,tile$y,bdry)},
bdry=bdry)
border <- sapply(inside,function(x){any(!x) | any(attr(x,"on.boundary"))})
plot(ctxy[border],main="Border tiles")
}
Run the code above in your browser using DataLab