library(rgl) ell<-300 twoell<-2*ell # "ell" controls the mesh size # take ell=100 to actually see the mesh in the 3-D plot # take ell=1000 to essentially fill the tracks black # - and get a 10 times larger pdf file! xgrid<- 90+(1:ell)*200/ell xgrid<-xgrid[xgrid<280] ygrid<-(0:17)*9/17 ell<-length(xgrid) twoell<-2*ell xygrid<-expand.grid(xgrid,ygrid) x<-xygrid$Var1 y<-xygrid$Var2 z<-rep(0,length(x)) yr<-y[x>99 & x<200] xr<-x[x>99 & x<200] xu<-x[x<100] yu<-y[x<100] theta<-pi*(200-xr)/200 # centre of circle (200,11) # x-radius = 11 # y-radius = 100 xc<-200 yc<-11 yrad<-yc xrad<-100 yrnew<-yc-(yc-yr)*cos(theta) xrnew<-xc-(xrad/yrad)*(yc-yr)*sin(theta) xunew<-yu*xrad/yrad+(xc-xrad) yunew<-yc+(100-xu)/10 # z[x>199]<-1.5*(y[x>199]-5)*dgamma(290-x[x>199], shape=3, scale=40/3) # z[x<200]<-1.5*(y[x<200]-5)*dgamma(290-x[x<200], shape=3, scale=40/3) mu<-40 sigma<-15 z[x>199]<- (y[x>199]-4)*dgamma(285-x[x>199], shape=7, scale=5)-1/(300-x[x>199]) z[x<200]<- (y[x<200]-4)*dgamma(285-x[x<200], shape=7, scale=5)-1/(300-x[x<200]) xp<-x yp<-y zp<-z xp[x<100]<-xunew yp[x<100]<-yunew xp[x>99 & x<200]<-xrnew yp[x>99 & x<200]<-yrnew xp[x<200]<-2*(100+xp[x<200])/3 xp<-(2*xp-min(xp)-max(xp))/(max(xp)-min(xp)) yp<-(2*yp-min(yp)-max(yp))/(max(yp)-min(yp)) zp<-(2*zp-min(zp)-max(zp))/(max(zp)-min(zp)) i<-8 a<-1+twoell*i xp1<-c( xp[ (a+twoell-1):(a+ell) ], xp[ a:(a+ell-1) ] ) yp1<-c( yp[ (a+twoell-1):(a+ell) ], yp[ a:(a+ell-1) ] ) zp1<-c( zp[ (a+twoell-1):(a+ell) ], zp[ a:(a+ell-1) ] ) plot3d(xp1,yp1,zp1,aspect=c(1.2,1,0.65),box=FALSE,axes=FALSE,xlab="",ylab="",zlab="",type="l",xlim=c(-1,1),ylim=c(-1,1),zlim=c(-1,1)) for (i in 0:7) { a<-1+twoell*i xp1<-c( xp[ (a+twoell-1):(a+ell) ], xp[ a:(a+ell-1) ] ) yp1<-c( yp[ (a+twoell-1):(a+ell) ], yp[ a:(a+ell-1) ] ) zp1<-c( zp[ (a+twoell-1):(a+ell) ], zp[ a:(a+ell-1) ] ) plot3d(xp1,yp1,zp1,aspect=c(1.2,1,0.65),type="l",add=TRUE) } M<-matrix(c( 0.84242517, 0.5231988, -0.1287744, 0, -0.09143636, 0.3743461, 0.9227700, 0, 0.53099817, -0.7655900, 0.3631980, 0, 0, 0, 0, 1),4,4,byrow=TRUE) par3d(FOV=170) par3d(userMatrix=M) par3d(zoom=0.18) # rgl.postscript("3dlogoMod.svg", fmt="svg", drawText=FALSE ) # Bottom left x1<-xp[seq(from=1,by=twoell,length=18)] y1<-yp[seq(from=1,by=twoell,length=18)] z1<-zp[seq(from=1,by=twoell,length=18)] # plot3d(x1,y1,z1,aspect=c(1.2,1,0.65),type="p",add=TRUE) # Bottom right x2<-xp[seq(from=ell,by=twoell,length=18)] y2<-yp[seq(from=ell,by=twoell,length=18)] z2<-zp[seq(from=ell,by=twoell,length=18)] # plot3d(x2,y2,z2,aspect=c(1.2,1,0.65),type="p",add=TRUE) # Top left x3<-xp[seq(from=ell+1,by=twoell,length=18)] y3<-yp[seq(from=ell+1,by=twoell,length=18)] z3<-zp[seq(from=ell+1,by=twoell,length=18)] # plot3d(x3,y3,z3,aspect=c(1.2,1,0.65),type="p",add=TRUE) # Top right x4<-xp[seq(from=twoell,by=twoell,length=18)] y4<-yp[seq(from=twoell,by=twoell,length=18)] z4<-zp[seq(from=twoell,by=twoell,length=18)] # plot3d(x4,y4,z4,aspect=c(1.2,1,0.65),type="p",add=TRUE) for( i in (1:8) ) plot3d(c(x4[i],x2[i+1]),c(y4[i],y2[i+1]),c(z4[i],z2[i+1]),aspect=c(1.2,1,0.65),type="l",add=TRUE) plot3d(c(x2[1],x2[1]+0.01),c(y2[1],y2[1]),c(z2[1],z2[1]),aspect=c(1.2,1,0.65),type="l",add=TRUE) plot3d(c(x4[9],x4[9]+0.01),c(y4[9],y4[9]),c(z4[9],z2[9]),aspect=c(1.2,1,0.65),type="l",add=TRUE) plot3d(c(x2[1]+0.01,x4[9]+0.01),c(y2[1],y4[9]),c(z2[1],z4[9]),aspect=c(1.2,1,0.65),type="l",add=TRUE) rgl.postscript("3dlogoMod.svg", fmt="svg", drawText=FALSE )