Monday, 28 May 2018

Processing drawing using Math.





Code for the final dragrams.

float t=0;

void setup() {
  size(1200, 500);
  background(0);
  //Usingg same formula three time with different constant in tis case 7 and 11
  translate(200,200);
  for(t=0;t<Math.PI*2;t+=0.001){
    float x=cos(t) + cos(7 * t)/2 + sin(11 * t)/3;
    float y=sin(t) + sin(7 * t)/2 + cos(11 * t)/3;
    noStroke();
    color c=color(38,191,250);
    fill(c);
    ellipse(100*x,100*y,3,3);
  }
  
  //here 6 and 14
  resetMatrix();
  translate(600,200);
  
  for(t=0;t<Math.PI*2;t+=0.001){
      float x=cos(t) + cos(6 * t)/2 + sin(14 * t)/3;
      float y=sin(t) + sin(6 * t)/2 + cos(14 * t)/3;
      noStroke();
      color c=color(38,191,250);
      fill(c);
      ellipse(100*x,100*y,3,3);
  }
  // in las one 5 and 15
  resetMatrix();
  translate(1000,200);
  
  for(t=0;t<Math.PI*2;t+=0.001){
      float x=cos(t) + cos(5 * t)/2 + sin(15 * t)/3;
      float y=sin(t) + sin(5 * t)/2 + cos(15 * t)/3;
      noStroke();
      color c=color(38,191,250);
      fill(c);
      ellipse(100*x,100*y,3,3);
  }
}

No comments:

Post a Comment