
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.




fcn archimedeanSpiral(a,b,circles){
   w,h:=640,640; centerX,centerY:=w/2,h/2;
   bitmap:=PPM(w+1,h+1,0xFF|FF|FF);  // White background
 
   foreach deg in ([0.0 .. 360*circles]){
      rad:=deg.toRad();
      r:=rad*b + a;
      x,y:=r.toRectangular(rad);
      bitmap[centerX + x, centerY + y] = 0x00|FF|00;  // Green dot
   }
   bitmap.writeJPGFile("archimedeanSpiral.jpg");
}(0,5,7);