Hello,
Tthis sketch doesn’t draw circles using segments of lines as it is expected to do. The positions do not evolve and I don’t understand why. It must be as plain as the nose on your face but I can’t see it…
float diameterX, diameterY, startX, startY, endX, endY;
int step;
void setup() {
size(1000, 1000);
background(64);
step = 99;
stroke(255,0,0);
strokeWeight(20);
}
void draw() {
step+=1;
if (step > 99) {
delay(1000);
step = 0;
background(64);
diameterX = random(width/2)+width/2;
diameterY = random(height/2)+height/2;
startX = sin(0)*diameterX/2; // or sin(0) or 0
startY = cos(0)*diameterY/2;
println("diameterx: "+diameterX+" / diametery: "+diameterY);
}
endX = sin((step+1)/100 * TWO_PI)*diameterX/2;
endY = cos((step+1)/100 * TWO_PI)*diameterY/2;
println("step: "+step+" / startX: "+startX+" / startY: "+startY+" / endX: "+endX+" / endY: "+endY);
line((int)(startX+width/2), (int)(startY+height/2), (int)(endX+width/2), (int)(endY+height/2));
startX = endX;
startY = endY;
}