I am just throwing an idea with possibility of closing. I need to draw a crystal ball in which red and blue particles randomly locate. I guess I have to go with photoshop, and even tried to make the ball in an image but as this is for research paper and does not have to be fancy, I wonder if there is any way to program with R, matlab, or any other language.
In R, using the rgl
package (R-to-OpenGL interface):
library(rgl) n <- 100 set.seed(101) randcoord <- function(n=100,r=1) { d <- data.frame(rho=runif(n)*r,phi=runif(n)*2*pi,psi=runif(n)*2*pi) with(d,data.frame(x=rho*sin(phi)*cos(psi), y=rho*sin(phi)*sin(psi), z=rho*cos(phi))) } ## http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations with(randcoord(50,r=0.95),spheres3d(x,y,z,radius=0.02,col="red")) with(randcoord(50,r=0.95),spheres3d(x,y,z,radius=0.02,col="blue")) spheres3d(0,0,0,radius=1,col="white",alpha=0.5,shininess=128) rgl.bg(col="black") rgl.snapshot("crystalball.png")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With