why is it not a perfect circle?
in
Programming Questions
•
2 years ago
i don't understan why it is not a perfect circle!!
- float inner_radius = 80f, outer_radius = 160f;
- int numpoint = 30;
- void setup() {
- size(500, 500);
- smooth();
- }
- void draw() {
- background(0);
- translate(width/2, height/2);
- float k = 6;
- float c[], s[];
- float theta=0, dt;
- noFill();
- stroke(200);
- c = new float[numpoint];
- s = new float[numpoint];
- stroke(200);
- noFill();
- dt=TWO_PI/(k*(numpoint));
- for(int spicchi=0; spicchi<k; spicchi++) {
- println( degrees(theta) );
- for(int i=0; i<numpoint; i++) {
- c[i] = cos(theta);
- s[i] = sin(theta);
- theta += dt;
- }
- beginShape();
- for(int i=0; i<numpoint; i++) {
- vertex(c[i]*inner_radius, s[i]*inner_radius);
- }
- for(int i=numpoint-1; i>0; i--) {
- vertex(c[i]*outer_radius, s[i]*outer_radius);
- }
- vertex(c[0]*inner_radius, s[0]*inner_radius);
- endShape();
- }
- println( degrees(theta) );
- noLoop();
- }
1