/* ---------------------------------------------- Computing Kaizen Studio Advanced Studio VI Spring 2010 Columbia University GSAPP Inverting Bodies Code by Paige Mader http://www.arch.columbia.edu/ http://proxyarch.com/kaizen This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License -----------------------------------------------*/ import traer.physics.*; class Node { float x,y,z,mass; String name; Node[] connections; color clr; int reach, depth, numLinks; boolean checked; ParticleSystem physics; Particle p; Spring[] springs; Attraction[] attractions; int deep; int id; PVector pos; Node(String _name, float _mass, float _x, float _y, float _z, ParticleSystem _physics, Node[] _others){ id = 0; reach = 0; deep = 200; depth = 0; numLinks = 0; checked = false; x = _x; y = _y; z = _z; mass = _mass; name = _name; connections = new Node[0]; pos = new PVector(x,y,z); physics = _physics; connections = new Node[0]; springs = new Spring[0]; attractions = new Attraction[0]; p = physics.makeParticle(mass, x, y, z); for(int i=0; i<_others.length; i++){ if( p != _others[i].p){ Attraction a = physics.makeAttraction( p,_others[i].p, attStrength, attMinDist ); Attraction b = physics.makeAttraction( _others[i].p, p, attStrength, attMinDist ); attractions = (Attraction[]) append(attractions, a); _others[i].attractions = (Attraction[]) append(_others[i].attractions, b); } } } void calcLinks(){ numLinks = connections.length; } int recursiveReach( int maxGenerations, int currentGeneration, float lineWidth, Node _parent){ int childCount = 1; if(_parent != null){ strokeWeight(lineWidth); line(x, y, z, _parent.x, _parent.y, _parent.z); } if( currentGeneration < maxGenerations){ for(int i=0; i