[R] Help with rgl

Yihui Xie xieyihui at gmail.com
Wed Feb 18 03:37:37 CET 2009


(1) you'll need ImageMagick installed to use the command "convert" to
convert image sequences into GIF animations; see ?movie3d
(2) "viewport" is read only!! see ?open3d carefully

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Tue, Feb 17, 2009 at 2:45 AM, Iuri Gavronski <iuri at ufrgs.br> wrote:
> 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