On 06/01/2012 9:13 AM, Phillip Von wrote:> Dear all,
> I have a question about the plotting of the dynamical orbit by using rgl.
> My code is as follows:
> open3d()
> par3d(cex=2)
> bg3d("white")
> for(i in 1:out.length){
> ind<-which
>
plot3d(x[1:i],y[1:i],out[,"z"][1:i],xlim=c(-10,10),ylim=c(-10,10),zlim=c(-10,10),col="red",cex=2)
> Sys.sleep(0.0001)
> }
> ,where x,y,out[,"z"] are the position of the object in different
time. I
> would like to show the orbit evoluting with time. However, I can just get
> animation with flash windows. I don't know how to use play3d to realise
> this dynamical orbit, are there anyone could help me for this?
> Thanks a lot!
If you just want to add points to the plot, then I'd use points3d() to
add them one at a time. (Or if you want them joined,
use lines3d() or segments3d() to add a line from the previous point to
the next one.) For example,
plot3d(numeric(0), numeric(0), numeric(0),
xlim=c(-10,10),ylim=c(-10,10),zlim=c(-10,10))
for(i in 1:out.length){
ind<-which
points3d(x[i],y[i],out[i,"z"],col="red",cex=2)
Sys.sleep(0.0001)
}