/* Structure 3 A surface filled with one hundred medium to small sized circles. Each circle has a different size and direction, but moves at the same slow rate. Display: A. The instantaneous intersections of the circles B. The aggregate intersections of the circles Implemented by Casey Reas 8 March 2004 Processing v.68 */ //parametrizzare i raggi delle bolle x decidere a che distanza devono unirsi int numCircle = 2; Circle[] circles = new Circle[numCircle]; void setup() { size(800, 600); frameRate(30); //Creazione delle bolle //Le bolle andrebbero create in modo tale da non essere sovrapposte //Il movimento dovrebbe essere verso il centro dello schermo circles[0] = new Circle(100, 100,20, 0.25,0, 0); circles[1] = new Circle(200, 100,20, -0.25, 0, 1); /*for(int i=0; i 0) { if(x > width+r) { x = -r; } } else { if(x < -r) { x = width+r; } } if(ysp > 0) { if(y > height+r) { y = -r; } } else { if(y < -r) { y = height+r; } } } } void intersect( Circle cA, Circle cB ) { float dx = cA.x - cB.x; float dy = cA.y - cB.y; float d2 = dx*dx + dy*dy; float d = sqrt( d2 ); if ( d>cA.r+cB.r || d di xx% rispetto ai raggi delle bolle if (d < 20) { cA.ax = paX; cA.ay = paY; cB.ax = pbX; cB.ay = pbY; cA.sp = 0; cA.ysp = 0; cB.sp = 0; cB.ysp = 0; stroke(100,100,100); line(paX, paY, pbX, pbY); //cA.draw(); //cB.draw(); } }