I am new in Processing and I need to turn all this wave PI / 8 with respect to its horizontal axis, I have tried with rotate () and translate () but I can not do it because everything is dismantled. Somebody help me please? I leave the code here:
int xspacing;
int w;
float theta ;
float amplitude = 75.0;
float period = 300;
float dx;
float[] yvalues;
void setup() {
size(600, 400);
xspacing = width/30;
period = width/2;
w = width+20;
dx = (TWO_PI / period) * xspacing;
yvalues = new float[w/xspacing];
}
void draw() {
background(255, 255, 255);
calcWave();
renderWave();
}
void calcWave() {
theta += 1/(60/PI);
float x = theta;
for (int i = 0; i < yvalues.length; i++) {
yvalues[i] = sin(x)*amplitude;
x+=dx;
}
}
void renderWave() {
noStroke();
fill(0, 0, 0);
for (int x = 0; x < yvalues.length; x++) {
ellipse(x*xspacing, height/2+yvalues[x], 10, 10);
}
}