aUCBLogo Demos and Tests / squaretest


to squaretest
   
cs
   
perspective
   
square
   
fd 100
   
square
end

to square
   
ifelse not name? "square_pos
   
[   square_width=40
      
square_pos=posXYZ

      
right 90 
      
forward square_width

         
square_edge=posXYZ
      
      
back square_width 
      
left 90
   
][
      
local [new_pos new_edge]

      
new_pos=posXYZ
      
pd
         
PolyStart
            
setPosXYZ PosXYZ
            
setPosXYZ square_pos
            
setPosXYZ square_edge
         
PolyEnd
         
PolyStart
            
setPosXYZ new_pos 
            
setPosXYZ square_edge
            
pu setPosXYZ new_pos
            
right 90
            
pd
            
forward square_width
         
PolyEnd
      
pu
      
square_edge=posXYZ
      
back square_width
      
left 90
      
square_pos=new_pos
   
]
end