he folks, I am struggeling with a nested loop problem, or at least thats what i think i am struggeling with^^....
I try to display (on screen) only every 5th value of a loop - I solved it with an if statement but this is very bad coding i think^^
any help would be greatly appreciated
thx
PFont font; float[] numbersPed; float[] numbersCar; int m1, m2; // number of steps float t2; // angle float x, y, z; float xm; float ym; float r; float c1, c2; boolean button = false; /// fuers umschalten zwischen ped und cars
void setup() { frameRate(27); font = loadFont("CordiaNew-bob.vlw"); size(600, 600); smooth(); xm = width/2; ym = height/2;
String[] lines= loadStrings("08082012__a.txt"); numbersPed = new float[lines.length]; numbersCar = new float[lines.length]; for (int i =0; i< lines.length; i = i+2) { numbersPed[i] = float(lines[i]); } for (int i =1; i< lines.length; i = i+2) { numbersCar[i] = float(lines[i]); } }
he folks, i am rather new to processing and I stuck with a problem. I try to visualize a motion detection with a line like a seismograph - so the line should grow over time. I tried a lot but it seems I am stumped. I post the most clear code with no experiments...
Any help is very appreciated.
ty B
/// average motion over certain time for (int i = 0; i < r1.length-1; i ++ ) { r1[i] = r1[i+1]; } r1[r1.length-1]=avgMotion; float sum = 0; for (int i = 0; i < r1.length; i++) { sum +=r1[i]; }
float avgMinute = sum/(totalTime/100);
float r = avgMotion*2;
if (timer.isFinished()) { println(avgMinute); x+=5; stroke(255); noFill(); strokeWeight(1);