// spiral phyllotaxis // mitchell whitelaw // based on an algorithm from Douady and Couder (1995) "Phyllotaxis as a Dynamical Self Organizing Process // Part I: The Spiral Modes Resulting from Time-Periodic Iterations" - http://www.math.ntnu.no/~jarlet/Douady96.pdf float growthrate = 0.2; float baseradius = 40; // radius of growth ring float maxradius = 400; // radius limit int numBases = 40; int maxPrimordia = 100; float inhibitionDecay = 0.01; float iThresh = 0.01; ArrayList Primordia = new ArrayList(maxPrimordia); Base[] Bases = new Base[numBases]; void setup(){ size(800,800); background(0); makeBases(); Primordium firstP = new Primordium(baseradius,random(TWO_PI)); Primordia.add(firstP); } void draw(){ translate(400,400); background(0); stroke(255); fill(0); for (int p=0; p maxradius) Primordia.remove(this); // kill if it's exceeded the radius age++; } void drawP(){ float xpos = radius*cos(angle); float ypos = radius*sin(angle); ellipse(xpos,ypos,10,10);//age*0.1,age*0.1); } } void keyPressed(){ if (keyCode == UP){ iThresh += 0.001; println("threshold: " + iThresh); } if (keyCode == DOWN){ iThresh -= 0.001; println("threshold: " + iThresh); } if (keyCode == LEFT){ growthrate -= 0.01; println("growthrate: " + growthrate); } if (keyCode == RIGHT){ growthrate += 0.01; println("growthrate: " + growthrate); } }