/* ---------------------------------------------- Computing Kaizen Studio Advanced Studio VI Spring 2010 Columbia University GSAPP Entangled Bodies Code by Maurizio Bianchi http://www.arch.columbia.edu/ http://proxyarch.com/kaizen This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License -----------------------------------------------*/ class Orbit{ PVector location; Orbit current; float speed, startSpeed, radius, startRadius, offset; boolean inside; boolean checked; float angle; float timeSinceSwitch; float clr ; Orbit(float inRadius, float inSpeed, boolean inInside){ current = null; radius = inRadius; startRadius = inRadius; speed = inSpeed; startSpeed = inSpeed; inside = inInside; location = new PVector(random(50,width-50), random(50,height-50), 0); PVector center = new PVector( width/2.0, height/2.0); clr = center.dist(location); //color range from center point checked = false; angle = random(0,360); timeSinceSwitch = 0; } void setCurrent(Orbit inCurrent){ current = inCurrent; } void checkShift(){ timeSinceSwitch += .2; //if(current != null){ for(int i=0; i 0){ a *= -1; } current = myOrbits[i]; angle = a; timeSinceSwitch = 0; } // } } } } void update(){ float cx, cy; cx = cy = 0; if(current != null){ if(current.current!=this){ angle += speed; //angle = angle + speed } cx = sin(radians(angle )) * (current.radius + radius + 1); cy = cos( radians(angle )) * (current.radius + radius + 1); location.x = cx + current.location.x; location.y = cy + current.location.y; } radius = max(radius-0.25, startRadius); speed = max(speed-0.1, startSpeed); } void plot(){ if(current != null){ strokeWeight(1); stroke(20); line(current.location.x, current.location.y, location.x, location.y); fill(max(0,100-timeSinceSwitch)); ellipse(location.x, location.y, radius*2, radius*2); } if(current == null){ noStroke(); fill(70); ellipse(location.x, location.y, radius*2, radius*2); } } void plotLines(){ if(current != null){ strokeWeight(2); stroke(30,100,100); line(current.location.x, current.location.y, location.x, location.y); } } }