void drawV3rtil() { for ( int i = 0; i < tendrils.size()-1; i++ ) { V3rtil t = (V3rtil)tendrils.get( i ); drawElastic( t ); } if ( tendrils.size()-1 >= 0 ) { drawElastic( (V3rtil)tendrils.lastElement() ); } } void drawElastic( V3rtil t ) { float lastStretch = 1; for ( int i = 0; i < t.particles.size()-1; ++i ) { Vector3D firstPoint = ((Particle)t.particles.get( i )).position(); Vector3D secondPoint = i+1 < t.particles.size() ? ((Particle)t.particles.get( i+1 )).position() : firstPoint; Spring s = (Spring)t.springs.get( i ); s.setStrength( 1.2 ); // Midi hier float springStretch = 2.5*s.restLength()/s.currentLength(); lastStretch = springStretch; degree = atan(abs((secondPoint.y() - firstPoint.y())) / abs((secondPoint.x() - firstPoint.x()))); if(firstPoint.x() < secondPoint.x()) { if(firstPoint.y() > secondPoint.y()) { // quadrant 1 degree *= -1; } else { //quadrant 2 } } else { if(firstPoint.y() < secondPoint.y()) { // quadrant 3 degree *= -1; degree += -PI; } else { //quadrant 4 degree += PI; } } noStroke(); outcount ++; if(random(0,10) > 8 && outcount > 3) { outcount = 0; if(random(0,10) > 5) { flipper = 1; } else { flipper = -1; } pushMatrix(); drawOut(int(random(32,45.9)), // SVGID firstPoint.x(), // POS X firstPoint.y(), // POS Y random(20,50), // SCALE degree * flipper + PI/2, // ROTATION 1, flipper); popMatrix(); } pushMatrix(); drawLine(int(random(1,30.9)), // SVGID firstPoint.x(), // POS X firstPoint.y(), // POS Y sqrt(sq(secondPoint.y() - firstPoint.y()) + sq(secondPoint.x() - firstPoint.x())) * 1.24, // SCALE degree); // ROTATION popMatrix(); } }