[R] Help with rgl

Duncan Murdoch murdoch at stats.uwo.ca
Wed Feb 18 16:14:16 CET 2009


On 18/02/2009 10:00 AM, Iuri Gavronski wrote:
> The funniest part is that we are close to carnival in Brazil...
> vacation time... more than 30C... and I am the one to try to get back
> to the track...
> 
> Any clue on how to rotate the object? Examples?

example(spin3d)

> 
> Also, still on the same object. If I change zoom, position, etc. with
> the mouse, where to query this information, for reproducing the same
> image later on?

See ?par3d.  When you release the mouse, the "userMatrix" is updated to 
reflect the current position.  You may also have changed "scale" and 
"projMatrix".

Duncan Murdoch

> 
> Best,
> 
> Iuri.
> 
> On Wed, Feb 18, 2009 at 6:56 AM, Uwe Ligges
> <ligges at statistik.tu-dortmund.de> wrote:
>>
>> Yihui Xie wrote:
>>> "Chinese extend a helping hand to Russians who happen to be in Brazil
>>> about a package written in Germany," which gladdened an American.
>>> Trotsky would be even more proud  -- and amazed!! :-)
>>
>>
>> Please note that rgl is maintained by a Canadian and two others (O. Nenadić
>> and W. Zucchini) who, I guess, are from different nationalities as well have
>> been involved in first versions of OpenGL interfaces.
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>>> 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 Wed, Feb 18, 2009 at 11:07 AM, roger koenker
>>> <roger at ysidro.econ.uiuc.edu> wrote:
>>>> Why I love R  [Number  6]:
>>>>
>>>> Chinese  extend a helping hand to Russians who happen to be in Brazil
>>>> about a package written in Germany.   Trotsky would be proud  -- and
>>>> amazed!
>>>>
>>>> url:    www.econ.uiuc.edu/~roger                Roger Koenker
>>>> email   rkoenker at uiuc.edu                       Department of Economics
>>>> vox:    217-333-4558                            University of Illinois
>>>> fax:    217-244-6678                            Champaign, IL 61820
>>>>
>>>>
>>>> On Feb 17, 2009, at 8:37 PM, Yihui Xie wrote:
>>>>
>>>>> (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)
>>>>>>
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list