int amplitude=10, frequency=TWO_PI/60, phase=0, k=1, leng=120; int v[]=new int [leng]; int r[]=new int [leng]; final int LOOPED=0, FIXED=1, FREE=2, MIXED=3; int ends=LOOPED; boolean circular=true; color colour; color colours[]=new color[leng]; //int sinArray[]=new int[721]; int xPos, yPos, oldxPos, oldyPos, c, i, t; int tinc = TWO_PI/150; int finc = TWO_PI/1000; int drawStyle=1, mode=2; int dp=leng*3/4; // driver position void simulateStep(){ // Forces between neighbours: for (i=1;i-10.2) println ("fps: " t*10000/millis()); t=0; background(0); simulateStep(); if (circular) { oldxPos= width/2+ fptoi(fptoi((itofp(height)/4+r[(leng-1)])*cos((leng-1)*TWO_PI/leng))); oldyPos=height/2+ fptoi(fptoi((itofp(height)/4+r[(leng-1)])*sin((leng-1)*TWO_PI/leng))); } else { oldxPos=0; oldyPos=height/2; } if (drawStyle==2) { beginShape(POLYGON); if (!circular) { vertex(width, height); vertex(0,height); } } for (int i=0; i