Created
February 2, 2012 15:59
-
-
Save kohske/1724211 to your computer and use it in GitHub Desktop.
twin tail function in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curve(sqrt(abs(1-x^2)), -1, -0.4, asp = 1, type = "l", xlim = c(-1.2, 1.2), ylim = c(-1.2, 1.2)) | |
curve(sqrt(abs(1-x^2)), 0.4, 1, add = T, type = "l") | |
curve(-sqrt(abs(1-x^2)), -1, -0.2, add = T, type = "l") | |
curve(-sqrt(abs(1-x^2)), 0.2, 1, add = T, type = "l") | |
curve(0.3 + 1.35 * sqrt(abs(0.6^2-x^2)), -0.6, 0.6, add = T, type = "l") | |
curve(0.3 + 1.35 * -sqrt(abs(0.6^2-x^2)), -0.6, 0.6, add = T, type = "l") | |
curve(-0.1+0*x, -0.5, -0.4, add = T, type = "l") | |
curve(-0.1+0*x, -0.2, 0.5, add = T, type = "l") | |
curve(0.3-4*abs(x+0.3), -0.4, -0.2, add = T, type = "l") | |
curve(-0.3 + 2 * -sqrt(abs(0.4^2-x^2)), -0.4, -0.2, add = T, type = "l") | |
curve(-0.3 + 2 * -sqrt(abs(0.4^2-x^2)), 0.2, 0.4, add = T, type = "l") | |
curve(0.3 + (x+0.6)*80, -0.61, -0.6, add = T, type = "l") | |
curve(0.3 - (x-0.6)*80, 0.6, 0.61, add = T, type = "l") | |
z <- cos(pi/4)*0.1 | |
curve(0.9 - z + sqrt(abs(0.1^2-(x-(0.4-z))^2)), 0.4-z-0.1, 0.4-z+0.1, add = T, type = "l", col = "red", lwd = 3) | |
curve(0.9 - z - sqrt(abs(0.1^2-(x-(0.4-z))^2)), 0.4-z-0.1, 0.4-z+0.1, add = T, type = "l", col = "red", lwd = 3) | |
curve(0.9 + z + sqrt(abs(0.1^2-(x-(0.4+z))^2)), 0.4+z-0.1, 0.4+z+0.1, add = T, type = "l", col = "red", lwd = 3) | |
curve(0.9 + z - sqrt(abs(0.1^2-(x-(0.4+z))^2)), 0.4+z-0.1, 0.4+z+0.1, add = T, type = "l", col = "red", lwd = 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curve((12/abs(x) - 4)*2, -6, -2, xlim = c(-6, 6), ylim = c(-6, 10)) | |
curve((12/abs(x) - 4)*2, 6, 2, add = T) | |
curve((-2+log(x+7)*4/(log(5)))*2, -6, -2, add=T) | |
curve((-2+log(7-x)*4/(log(5)))*2, 2, 6, add=T) | |
curve(4 + cos(exp(-x)*pi*2) * 0.2, -2, 2, add = T) | |
curve(8 - (exp(abs(x))^2)/15, -2, 2, add = T) | |
curve(0 + (exp(abs(x))^2)/20, -2, 2, add = T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj <- r3js_new() | |
col <- "#888800" | |
x <- seq(-6, -2, 0.01); y <- (12/abs(x) - 4)*2; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
x <- seq( 2, 6, 0.01); y <- (12/abs(x) - 4)*2; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
x <- seq(-6, -2, 0.01); y <- (-2+log(x+7)*4/(log(5)))*2; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
x <- seq( 2, 6, 0.01); y <- (-2+log(7-x)*4/(log(5)))*2; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
x <- seq(-2, 2, 0.01); y <- 4 + cos(exp(-x)*pi*2) * 0.2; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
x <- seq(-2, 2, 0.01); y <- 8 - (exp(abs(x))^2)/15; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
x <- seq(-2, 2, 0.01); y <- 0 + (exp(abs(x))^2)/20; z <- rep(0, length(x)); y <- y * 0.75 | |
obj <- r3js_add(obj, r3js_line(x, y, z, lwd = 5, alpha = 1, col = col)) | |
obj$camera <- list(radius = 10) | |
obj$options <- list(axisbox = FALSE, axisline = FALSE) | |
r3js_gen(obj, name = "twintail", browse = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool :)