Skip to content

Instantly share code, notes, and snippets.

@tpoisot
Created April 7, 2016 18:02
Show Gist options
  • Save tpoisot/0a04547e7c2cb0770ebdca9d9366f7d5 to your computer and use it in GitHub Desktop.
Save tpoisot/0a04547e7c2cb0770ebdca9d9366f7d5 to your computer and use it in GitHub Desktop.
library(tripack)
library(viridis)
library(grDevices)
n <- 40
x <- runif(n)
y <- runif(n)
gr <- expand.grid(c(1:n), c(1:n), c(1:n))
gr <- unique(t(apply(gr, 1, sort)))
alldif <- apply(gr, 1, function(x) length(unique(x)) == length(x))
gr <- gr[alldif,]
pal <- adjustcolor(inferno(1000), alpha=0.4)
plot(x=x, y=y, asp=1, pch=NA)
for(i in c(1:nrow(gr))){
c = circumcircle(x[gr[i,]], y[gr[i,]], num.touch=3)
circles(x=c$x, y=c$y, r=c$radius, col=pal[round(c$radius*1000,0)], lwd=2)
}
points(x=x, y=y, pch=21, bg='darkgrey', lwd=9+rnorm(n, mean=0), cex=3+rnorm(n, mean=0), col="lightgrey")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment