size(200,200); smooth(); background(255); fill(0); noStroke(); int nbr_circles = 200; float phi = (sqrt(5)+1)/2 - 1; // golden ratio float golden_angle = phi * TWO_PI; // golden angle float lg_rad = width * .45; float lg_area = sq(lg_rad) * PI; float sm_area = lg_area / nbr_circles; // Area of our little circles, if they filled the space entirely float sm_rad = sqrt( sm_area / PI ); // This is related to the equation area = pi r squared float fudge = .87; // Fudge factor, since our circles don't actually fill up space entirely. float adj_sm_diameter = sm_rad * 2 * fudge; float cx = width/2; float cy = height/2; for (int i = 1; i <= nbr_circles; ++i) { float angle = i*golden_angle; float cum_area = i*sm_area; float spiral_rad = sqrt( cum_area / PI ); float x = cx + cos(angle) * spiral_rad; float y = cy + sin(angle) * spiral_rad; ellipse(x, y, adj_sm_diameter, adj_sm_diameter); }