/* bubbleBubble_v02 Click to draw bubbles September 2007 Processing v.0124 */ int idxCircle = 1; Circle[] circles = new Circle[100]; int keyIndex; color bubble = color(192,252,97); color bg = color(93,168, 253); void setup() { size(800, 600); frameRate(30); //noCursor(); 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; } } } } //questo mi serve per avere l'equazione della retta che passa per il //centro del cerchio e il punto di intersezione, cioč quella //su cui sta il raggio float r(float m, float p, float x) { return (x*m) + p; } float equ_rect_m(float x1,float y1, float x2, float y2){ return (y2 - y1) / (x2 - x1); } float equ_rect_p(float x1,float y1, float x2, float y2){ return ((x2 * y1) - (x1 * y2) ) / (x2 - x1); } 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