Lissajous tables

Hi! I created a new project! The Lissajous tables! Difficulty: 1000/10

int cx = 300, cy = 300,scl=60,a=10,b=10;
void setup() {
  size(600,600);
}
void draw() {
  background(0);
  stroke(255);
  for(int i = 1; i < a+1; i++) {
    for(int j = 1; j < b+1; j++) {
      
      for(int k = 0; k < 1000; k++) {
        float a = TWO_PI/1000;
        float x = scl/2 * cos(a*k*i), y = scl/2 * sin(a*k*j);
        point(x+(i-0.5)*scl,y+(j-0.5)*scl);
      }
    }
  }
}

or a shorter version:

size(600, 600);
for (int i = 1; i < 11; i++) for (int j = 1; j < 11; j++) for (int k = 0; k < 1000; k++) {
  point(30 * cos(TWO_PI/1000*k*i)+(i-0.5)*60, 60/2 * sin(TWO_PI/1000*k*j)+(j-0.5)*60);
}

or a bit longer version

int scl = 60, a = 10, b = 10;
size(600, 600);
background(0);
stroke(255);
for (int i = 1; i < a+1; i++) for (int j = 1; j < b+1; j++) for (int k = 0; k < 1000; k++) {
  point(scl/2 * cos(TWO_PI/1000*k*i)+(i-0.5)*scl, scl/2 * sin(TWO_PI/1000*k*j)+(j-0.5)*scl);
}

6 Likes

If you want to add a buffer (padding around the shapes)

int a = 10, b = 10, scl = 60, buffer = 10;
size(720,720);
background(0);
stroke(255);
for(int i = 1; i < a + 1; i++) {
  for(int j = 1; j < b + 1; j++) {
    for(int k = 0; k < 1000; k ++) {
      float ang = TWO_PI/1000;
      point( (i-0.5)*scl+i*buffer + scl/2 * cos(ang*k*i), (j-0.5)*scl + j*buffer + scl/2 * sin(ang*k*j));
      
    }
  }
}

You can also do this:

1 Like

That one would make a sick album cover :smiley:
Iā€™m thinking about some minimalist drone or something :thinking: