
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.




float x, y;
float theta;
float rotation;
 
void setup() {
  size(300, 300);
  theta = 0;
  rotation = 0.1;
  background(255);
}
 
void draw() {
  translate(width/2.0, height/2.0);
  x = theta*cos(theta/PI); 
  y = theta*sin(theta/PI);
  point(x, y);   
  theta = theta + rotation;
  // check restart
  if (x>width/2.0) frameCount=-1;
}