//pattern 1 float p=PI; //ratio by which random distances are determined float xtf; //carrier for flipper float ytf; //carrier for flipper float o; //for calculating tan-1 float a; //for calculating tan-1 float theta; //for trigonometry float L; //for trigonometry (hypotenuse) float nL; //random new hypotenuse int choice; //random choice int q; //random child index float xta; // carrier variable float yta; // carrier variable float xtb; // carrier variable float ytb; // carrier variable // child co-ord table float [] xva=new float[200+int(random(100))]; float [] yva=new float[xva.length]; float [] xvb=new float[xva.length]; float [] yvb=new float[xva.length]; void setup (){ size (500,300); background (255); //graph paper for 400x400 //stroke(220); //for(int j=0; j<405; j+=5) { // line (j,0,j,400); // line (0,j,400,j); //} //stroke (180); //line (200,0,200,400); //line (0,200,400,200); xva[0]=200; yva[0]=200; xvb[0]=300; yvb[0]=100; stroke(0); } void loop () { noStroke(); fill(255); rect(0,0,width,height); //child co-ord creator for (int i=1; iTWO_PI){ theta-=TWO_PI; } xtb=xta+(cos(theta)*nL); ytb=yta+(sin(theta)*nL); } void rotation() { float nTheta=(theta-(TWO_PI/p))+(random(TWO_PI/p)*2); if (theta<0){ theta+=TWO_PI; } else if (theta>TWO_PI){ theta-=TWO_PI; } xtb=(xta+(cos(nTheta)*nL)); ytb=(yta+(sin(nTheta)*nL)); } //Button boolean overRect(int x, int y, int width, int height) { if (mouseX >= x && mouseX <= x+width && mouseY >= y && mouseY <= y+height) { return true; } else { return false; } }