aUCBLogo Demos and Tests / 3dplot
			
				
			
			be 3dplot
   perspective
   setpc 1
   setPenSize [0 0]
   ht
   cs
   
   local [phi eye]
   ifelse Name? "framenr [phi=framenr*10][phi=0]
   dphi=5
   eye=array 3
   eye.1= 50
   eye.2=200
   eye.3=500
   
   ;HELICOID
   ;DRAW[..].. here when using redraw
   draw [-0.6 0.6 0.04] 
      [-1.5*pi 1.5*pi 0.15]
      [size*u*radcos v]
      [size*u*radsin v]
      [size/c*v]
      [size 150 c 6]
      [offset [0 0 0]]
   
   pr [press + or - be change rotation speed, ESC exits]
   forever
   [   ;cs
      make "phi phi+dphi
      eye.1= -500*sin phi
      eye.3=500*cos phi
      seteye eye {0 0 0}{0 1 0}
      redraw
      if Name? "framenr [break]
      dispatchMessages
      if key? 
      [   ch=readChar
         if ch=="+ [dphi=dphi+1]
         if ch=="- [dphi=dphi-1]
         if ch==char 27 [break]
      ]
      waitms 10
      gc
   ]
   show "finished
   ;unicon "commander
   be draw urange vrange xexpr yexpr zexpr param plotparam
      ; urange u VALUES [start finish incr]. CAN INVOLVE PRAMETERS GIVEN IN param
      ; vrange v VALUES [start finish incr]. CAN INVOLVE PRAMETERS GIVEN IN param
      ; xexpr etc. PARAMETRIC EQNS IN u AND v. OTHER PARAMS DEFINED IN param
      ; param  EQN PARAMETERS AND VALUES. MUST NOT INVOLVE u and v
      ; plotparam  offset IN FORM [<x> <y> <z>] ;eyepos IN FORM {<x> <y> <z>}
      assign_val param assign_val plotparam
   
      local [xoff yoff zoff u_start u_end v_start v_end uincr vincr]
         xoff=run (list first ::offset)
         yoff=run (list first bf ::offset)
         zoff=run (list last ::offset)
      u_start=run (list first urange)
        u_end=run (list first bf urange)
      v_start=run (list first vrange)
        v_end=run (list first bf vrange)
        uincr=run (list last urange)
        vincr=run (list last vrange)
      local [u v]
      u=u_start
      pu
      repeat (round (u_end-u_start)/uincr)+1
      [   v=v_start
         repeat (round (v_end-v_start)/vincr)+1
         [   cell u v uincr vincr 
            v=v+vincr
         ]
         u=u+uincr
      ]
   
      be cell u v uincr vincr   ;CELL PLOT
         setxyz xoff+x u v  yoff+y u v zoff+z u v
         pd
         setxyz xoff+x u+uincr v  yoff+y u+uincr ~
               v zoff+z u+uincr v
         setxyz xoff+x u+uincr v+vincr  yoff+y ~
               u+uincr v+vincr zoff+z u+uincr v+vincr
         setxyz xoff+x u v+vincr  yoff+y u v+vincr ~
               zoff+z u v+vincr
         setxyz xoff+x u v  yoff+y u v zoff+z u v
         pu
      end
      
      be x u v
         op run xexpr
      end
      
      be y u v
         op run  yexpr
      end
      
      be z u v
         op run zexpr
      end
   end
end
to assign_val val_list    ;ASSIGNS PARAMETER VALUES
   if empty? val_list [ stop]
   make (first val_list) run (list first bf val_list)
   assign_val bf bf val_list
end