Basic Spiral


  size(200, 200);
  smooth();
  
  int   nbr_circles = 100;
  float angle_incr = radians(2); // also try radians(sqrt(2)*360)
  
  background(255);
  
  fill(0);
  
  float cx = width/2;
  float cy = height/2;
  float outer_rad = width*.45;
  
  float sm_diameter = 4;
  
  for (int i = 1; i <= nbr_circles; ++i) {
    float ratio = i/(float)nbr_circles;
    float spiral_rad = ratio * outer_rad;
    float angle = i*angle_incr;
    float x = cx + cos(angle) * spiral_rad;
    float y = cy + sin(angle) * spiral_rad;
  
    // draw tiny circle at x,y
    ellipse(x, y, sm_diameter, sm_diameter);
  }