
The Archimedean spiral is a spiral named after the Greek mathematician Archimedes.



An Archimedean spiral can be described by the equation:






r
=
a
+
b
θ


{\displaystyle \,r=a+b\theta }


with real numbers a and b.



Task
Draw an Archimedean spiral.




#MAXLOOP  = 7*360
#XCENTER  = 640/2
#YCENTER  = 480/2
#SCALAR   = 200
 
If OpenWindow(0, 100, 200, 640, 480, "Archimedean spiral")  
  If CreateImage(0, 640, 480,24,RGB(255,255,255))
    If StartDrawing(ImageOutput(0))      
      i.f=0.0
      While i<=#MAXLOOP         
        x.f=#XCENTER+Cos(Radian(i))*#SCALAR*i/#MAXLOOP
        y.f=#YCENTER+Sin(Radian(i))*#SCALAR*i/#MAXLOOP
        Plot(x,y,RGB(50,50,50))
        i+0.05
      Wend
      StopDrawing()
    EndIf
  EndIf  
  ImageGadget(0, 0, 0, 0, 0, ImageID(0))        
  Repeat : Event = WaitWindowEvent() : Until Event = #PB_Event_CloseWindow 
EndIf
End