# A mouse-oriented animation: click at one of the 4 corners or towards the center of the
# sides of the figure; finally press ESC.
t = seq(0,2*pi,len=100); r = 10/4
x = y = z0 = c(0,10)
z = c(0,0,0,0); z = array(z,dim=c(2,2))
teta = 30; fi = 40
while(TRUE) {
  F <- persp(x,y,z,theta=teta,phi=fi,zlim=z0,xlim=x,ylim=y,d=1,scale=FALSE)
  lines(trans3d(c(0,10,10,0,0,5,5,0,0,10),c(0,0,10,10,0,0,10,10,5,5),0,pmat=F),col="red")
  lines(trans3d(10/4+r*cos(t),10/4+r*sin(t),0,pmat=F),col="red")
  lines(trans3d(10/4*3+r*cos(t),10/4+r*sin(t),0,pmat=F),col="red")
  lines(trans3d(10/4*3+r*cos(t),10/4*3+r*sin(t),0,pmat=F),col="red")
  lines(trans3d(10/4+r*cos(t),10/4*3+r*sin(t),0,pmat=F),col="red")
  title(paste(teta,"°  ",fi,"°")); l <- locator(1); a <- c(l$x,l$y)
  if(a[2] > 0.3) fi <- fi-1; if(a[2] < -0.3) fi <- fi+1;
  if(a[1] > 0.3) teta <- teta-1; if(a[1] < -0.3) teta <- teta+1;
}

#
# See here to see the animation with Cinderella