Description Usage Arguments Value Examples
Compute distance matrix for a list of polygons
1 2 3 4 5 6 |
list.poly |
a list of nx2 numeric matrices |
delta |
a positive number |
gradients |
a 2x n matrix each column representing a vector. |
a (n*(n-1)/2)x 3 matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | zz<-function(delta){
list.poly=plyr::alply(cbind(rep(0:8,9),rep(0:8,each=9))[sample(81,20),],1,function(x){
cbind(x[1]+c(0,0,.5,.5,0),x[2]+c(0,.5,.5,0,0))})
gradients=cbind(c(0,1),c(1,0),c(1,1),c(1,-1))
par(mfrow=c(1,1),oma=c(0,0,1,0),mar=c(0.1,0.1,1,0.1))
plot(do.call(rbind,list.poly),xlab="",yaxt="n",ylab="",cex=.1,main=paste0("Match polygons distant less than ",delta))
for(.poly in list.poly){points(.poly,type="l")}
X=polysmalldistmat(list.poly,delta)
for(i in 1:nrow(X)){
points(closestpointsontwopolygons(list.poly[[X[i,1]]],list.poly[[X[i,2]]]),col="red",type="l",lty=3)
}}
set.seed(1);zz(.5)
set.seed(1);zz(1)
set.seed(1);zz(2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.