working on my basic skills...
Please run this,
at the right sight there is a gap sometimes, i would like to solve this.
- int segments = 360;
- int radius = 300;
- void setup() {
- size(800, 800);
- colorMode(HSB, 360, 100, 100);
- noStroke();
- // smooth();
- }
- void draw() {
- background(360);
- float segments = map(mouseX, 0, width, 3, 360);
- // get something that is good for making exact 360
- // ?
- float angleStep = 360f/segments;
- beginShape(TRIANGLE_FAN);
- vertex(width/2, height/2);
- for (float angle = 0; angle <= 360; angle += angleStep) {
- float vx = width/2 + cos(radians(angle))*radius;
- float vy = height/2 + sin(radians(angle))*radius;
- vertex(vx, vy);
- fill(angle, 100, 100);
- }
- endShape();
- }
With this i can get the numbers that are good to divide 360 to.
Don't know if it's needed.
could someone help me with the next step?
- float a = 360;
- while(a > 0) {
- float s1 = 360/a;
- int s2 = int(s1);
- if(s1-s2 == 0) {
- println(s2);
- }
- a--;
- }
1