allIntersections <- local({
all.combs <- function(n,singles=TRUE) {
    v <- vector("list",n)
    inds <- if(singles) 1:n else 2:n
    for(i in inds) {
        v[[i]] <- as.list(as.data.frame(combn(n,i)))
    }
    do.call(c,v)
}

function (ttt,singles=TRUE,tess=TRUE) {
tiles  <- ttt$tiles
ntiles <- length(tiles)
inds   <- all.combs(ntiles,singles=singles)
rslt   <- vector("list",length(inds))
names(rslt) <- rep("",length(rslt))
K      <- 0
for(ind in inds) {
   K <- K+1
   w <- try(do.call(intersect.owin,c(tiles[ind],list(fatal=FALSE))),silent=TRUE)
   if(inherits(w,"try-error") || is.empty(w)) w <- NULL
   if(!is.null(w)) {
       lbl <- paste(ind,collapse=".")
       names(rslt)[K] <- lbl
       rslt[[K]] <- w
   }
}
rslt <- rslt[!sapply(rslt,is.null)]
if(tess) rslt <- tess(tiles=rslt)
rslt
}
})
