Dear R-users,

    within the rgl-package, I would have a question about the usage of persp3d in combination of rgl.viewpoint. 
I am not able to figure out how to let a 3D plot rotating around likewise the example in ?rgl.viewpoint. It seems that when I use persp3d(...) I see something on my screen, which is different from what I get when it's rotating. Is there any different behavior between shade3d and persp3d?
Please find below a simple example.

Actually, my final aim is to save each of the rotating graphs for creating a "clip". I commented below what I would use later on, but is there any way to do it better?

Thanks a lot for your help,
Carlo Giovanni Camarda


library(rgl)
# simplified version from help(rgl.viewpoint)
shade3d(oh3d())
coo <- 1:360
for(i in 1:length(coo)) {
    rgl.viewpoint(coo[i])
    #filename <- paste("pic", formatC(i,digits=1,flag="00"), ".png", sep="")
    #rgl.snapshot(filename)
}

# simple persp3d adaption
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
x <- seq(-10, 10, length= 30); y <- x
z <- outer(x, y, f)
persp3d(x, y, z)
coo <- 1:360
for(i in 1:length(coo)) {
    rgl.viewpoint(coo[i])
    #filename <- paste("pic", formatC(i,digits=1,flag="00"), ".png", sep="")
    #rgl.snapshot(filename)
}



-----------------------------------------------------
Dr. Carlo Giovanni Camarda
Research Scientist
Max Planck Institute for Demographic Research
Laboratory of Statistical Demography
Konrad-Zuse-Straße 1
18057 Rostock - Germany
Phone: +49 (0)381 2081 172
Fax: +49 (0)381 2081 472
camarda@demogr.mpg.de
http://www.demogr.mpg.de/en/staff/camarda/default.htm
-----------------------------------------------------


----------
This mail has been sent through the MPI for Demographic ...{{dropped:10}}


