[R] Help with rgl

Iuri Gavronski iuri at ufrgs.br
Mon Feb 16 19:45:11 CET 2009


Hi,

I don't know much about the RGL package, and I have read the
documentation and tried some parameters, with no luck... I would like
to generate a movie from a 3D object (code below), where the vortex A
is closer to the observer, and then the object rotates and the B
vortex gets closer. I would like to capture this movie to a file.

By the way, I am not being able to insert unicode text with text3d.

rgl 0.82, R 2.8.1, Windows Vista.

Any help would be appreciated.

Code follows:

library(rgl)
open3d()

coord.1=c(0,100,0)
coord.2=c(100,100,0)
coord.3=c(100,0,0)
coord.4=c(0,0,0)
coord.5=c(50,50,70)

pyrcolor="red"
triangles3d(rbind(coord.1,coord.4,coord.5),color=pyrcolor)
triangles3d(rbind(coord.1,coord.2,coord.5),color=pyrcolor)
triangles3d(rbind(coord.2,coord.3,coord.5),color=pyrcolor)
triangles3d(rbind(coord.3,coord.4,coord.5),color=pyrcolor)
quads3d(rbind(coord.1,coord.2,coord.3,coord.4),color=pyrcolor)

vertices = LETTERS[1:5]
text3d(coord.1,text=vertices[1],adj=1,color="blue")
text3d(coord.2,text=vertices[2],adj=0,color="blue")
text3d(coord.3,text=vertices[3],adj=0,color="blue")
text3d(coord.4,text=vertices[4],adj=1,color="blue")
text3d(coord.5,text=vertices[5],adj=0,color="blue")

# couldn't make this work...
#open3d(viewport=c(0,0,686,489))
#par3d(zoom = 1.157625)

filename = "piramide.png"
rgl.snapshot(filename)




More information about the R-help mailing list