Skip to content

Instantly share code, notes, and snippets.

@martinctc
Created March 20, 2017 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinctc/ccf4ed7171b3b45a72d4d05967878376 to your computer and use it in GitHub Desktop.
Save martinctc/ccf4ed7171b3b45a72d4d05967878376 to your computer and use it in GitHub Desktop.
Bho
circle <- function(xorig, yorig, radius, add, ...){
x <- seq(-radius, radius, length.out = 1000)
y <- sapply(x, function(z) sqrt(radius^2 - z^2))
if(add == TRUE){
lines(xorig + c(x, rev(x)), c(yorig + y, yorig + rev(-y)),
type = "l", ...)
} else {
plot(xorig + c(x, rev(x)), c(yorig + y, yorig + rev(-y)),
type = "l", ...)
}
}
mo.y <- rep(0.15,100)
mo.x <- seq(0.2,0.8,length=100)
circle(0.3, 0.75, 0.20, add = FALSE,
main = "A Mo",
xlab = "",
ylab = "", ylim=c(-0.5,1), xlim=c(0,1), col="red",lwd=4)
circle(0.5,0.25,0.55,add=TRUE,col="black",lwd=4)
circle(0.72, 0.75, 0.20, add = TRUE, col="red",lwd=4)
circle(0.5, 0.5, 0.18, add = TRUE, col="orange",lwd=4)
circle(0.3, 0.75, 0.10,add=TRUE,col="black",lwd=4)
circle(0.72, 0.75, 0.10,add=TRUE,col="black",lwd=4)
lines(mo.y~mo.x,lwd=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment