get.neighbor <- function (connectivity=c(26L,18L,6L)) {
out <- switch(as.character(connectivity),
`6` = t(matrix(c(1,2,2,2,1,2,2,2,1,3,2,2,2,3,2,2,2,3), nrow=3)),
`18` = t(matrix(
c(1,1,2,1,2,1,1,2,2,1,2,3,1,3,2,2,1,1,2,1,2,2,1,3,2,2,1,2,2,2,
2,2,3,2,3,1,2,3,2,2,3,3,3,1,2,3,2,1,3,2,2,3,2,3,3,3,2), nrow=3)),
`26` = t(matrix(
c(1,1,1,1,1,2,1,1,3,1,2,1,1,2,2,1,2,3,1,3,1,1,3,2,1,3,3,2,1,1,
2,1,2,2,1,3,2,2,1,2,2,3,2,3,1,2,3,2,2,3,3,3,1,1,3,1,2,3,1,3,
3,2,1,3,2,2,3,2,3,3,3,1,3,3,2,3,3,3), nrow=3)),
otherwise=stop("connectivity not recognized, use 26, 18, or 6"))
out <- out - 2
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.