aUCBLogo Demos and Tests / mul3


to mul3
   
; Multiplikativer Zahlring, nur drei Farben, Wechsel nach jeder Linie
   
cS hT setSC 0 noRefresh
   
g=2048 r=300 ; Radius des Kreises
   
alpha=-Pi/2 ; der erste Punkt liegt dann unten
   
zwoPi= 2*Pi
   
p=3 
   
i=0 colors=(List RGB 1 0 0  RGB 0 1 0  RGB 0 0 1) 
   
   
pr [ESC stops, any other key pauses]
   
   
for [f 0 g-1] 
   
[   for [n 1 g-1] 
      
[   for [m -1 1]
         
[   beta=m*(2*Pi/p)
         
            
phi1=alpha+beta+zwoPi*f/g            
            
x1=r*radCos phi1 
            
y1=r*radSin phi1
            
            
phi2=alpha+beta+zwoPi*(mod n*f g)/g  
            
x2=r*radCos phi2 
            
y2=r*radSin phi2
            
            
coords=fPut Se x1 y1 lPut Se x2 y2 []
            
line coords Item (1+mod i 3) colors i=i+1
         
]
      
]
      
updateGraph
      
if key? 
      
[   ch=readChar
         
if ch==char 27 [stop]
         
while [not key?] []
         
ch=readChar
      
]
   
]
end