class FunctionGenBox { float x, y, w, h; float start, duration; //time, in seconds float freq; FunctionGenBox[] all; FunctionGenBox(float sze, float freq) { this.x = 0; this.y = 0; this.w = sze; this.h = sze; this.freq = freq; this.start = 0; this.duration = .01; } void setAll(FunctionGenBox[] all) { this.all = all; } void stepAndRender() { float tick = this.duration / this.w; //in seconds per pixel fill(255, 100); rect(this.x, this.y, this.w, this.h); noFill(); beginShape(); for(float curx=this.x; curx= this.all[i].x && x <= this.all[i].x + this.all[i].w) { acc += this.all[i].getThisY(this.all[i].xToI(x)); num += 1; } } return acc; // todo: normalize? } void moveBy(float dx, float dy) { this.x += dx; this.y += dy; } }