/* ---------------------------------------------- Computing Kaizen Studio Advanced Studio VI Spring 2010 Columbia University GSAPP Distressed Bodies Code by Biayna Bogosian 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 Connections{ Node link0, link1; Spring mySpring; float stress; int hold; Connections(Node _link0, Node _link1){ mySpring = physics.makeSpring(_link0.theParticle,_link1.theParticle, 5, 1.0, spacing/4.0); link0 = _link0; link1 = _link1; stress = 0.0; hold = 0; } void update(){ stress = abs(mySpring.restLength() - link0.location.dist(link1.location) ); stroke( 200 - min(200,stress*5) ); strokeWeight(2); float x,y,z,x1,y1,z1; x = link0.theParticle.position().x(); y = link0.theParticle.position().y(); z = link0.theParticle.position().z(); x1 = link1.theParticle.position().x(); y1 = link1.theParticle.position().y(); z1 = link1.theParticle.position().z(); line(x,y,x1,y1); } }