Ralph-Assignement-06-LasercutScreen (UPDATED)

The pattern currently does not utilize a particle system. I am still working on making each hexagonal unit (as a particle) stack on top of each other in an organic way using repulsion force. While I’m still tweaking that, I put together this image as my placeholder piece for now.

poop
poop

UPDATE!
The code is working precisely as I described now. Here’s the son-of-a-bitch:
Link to the piece on OP: https://openprocessing.orgsketch/113878

poop poop

ArrayList myPattern;
int maxPattern = 1;

void setup() {
  size (864, 864);
  myPattern = new ArrayList();
}

void draw() {

  background(255);

  for (int i=0; i= ithPattern.py) {

        float jx = jthPattern.px;
        float jy = jthPattern.py;
        float ix = ithPattern.px;
        float iy = ithPattern.py;
        float distance = sqrt((jy-iy)*(jy-iy) + (jx-ix)*(jx-ix));

        //radius of pattern
        if (distance < (jthPattern.l*2.6 + ithPattern.l*2.6)) { 
          myPattern.get(i).addForce(0, 0);
          ithPattern.vy = 0;
        }
      }
    }

    ithPattern.update();
    ithPattern.render();
  }

  if (maxPattern < 400) {
    maxPattern ++;
  }
}

//=========================================================================


class Pattern {
  float l;
  float ptheta;
  float px;
  float py;
  float vx;
  float vy;

  //constructor for Pattern
  Pattern(float x, float y, float theta, float rl) {
    ptheta = theta;
    px = x;
    py = y;
    l = rl;
  }

  // Add a force in. One step of Euler integration.
  void addForce (float fx, float fy) {
    float ax = fx;
    float ay = fy;
    vx += ax;
    vy += ay;
  }

  void update() {
    px += vx;
    py += vy;
    if (py > height) { //land
      py = height;
    }
  }

  void render() {
    pushMatrix();
    translate(px, py);
    rotate(ptheta);
    noFill();
    strokeWeight(1);
    line(-l, 0, -l/2, round(-0.866*l));
    line(-l/2, round(-0.866*l), l/2, round(-0.866*l));
    line(l/2, round(-0.866*l), l, 0);
    line(l, 0, l/2, round(l*0.866));
    line(l/2, round(l*0.866), -l/2, round(l*0.866));
    line(-l/2, round(l*0.866), -l, 0);
    for (int i = 0; i < 6; i++) {
      rotate(PI/3);
      rect(-l/2, 3*l/2, l, l/2);
    }
    popMatrix();
  }
}

Comments are closed.