Adam-Assignment-06-LasercutScreen

Warp

I was thinking about Wood Bora for this project and imagining what would happen if they co-ordinated their “boring” efforts.

I wanted to create a point mesh that would then be distorted by a point travelling over it using an inverse square relationship.

Early attempts:
Screen Shot 2013-10-03 at 11.47.21 AM

Screen Shot 2013-10-03 at 11.47.43 AM

Unfortunately I was unable to get the points to stay in their new positions and had to borrow some code of the internet.

Using an adaptation of code that Golan had written for me and some help from Miles. The code is no longer borrowed, but my own!

Final attempts:

./wp-content/uploads/sites/2/2013/10/5.pdf
./wp-content/uploads/sites/2/2013/10/4.pdf
./wp-content/uploads/sites/2/2013/10/3.pdf
./wp-content/uploads/sites/2/2013/10/2.pdf
./wp-content/uploads/sites/2/2013/10/6.pdf
./wp-content/uploads/sites/2/2013/10/1.pdf

int numParticles = 19600;
PVector[] positions = new PVector[numParticles];

void setup() {
  size (700, 700); 
  smooth();
  noStroke();
  noFill(); 
  fill(0);

  for (int y=0; y<140; y++) {
    for (int x=0; x<140; x++) {
      positions[y*140+x] = new PVector(x*5, y*5);
    }
  }
}

void draw() {
  background(255); 
  float xOffset = 0; 
  float yOffset = 0;
  float xScale = 5; 
  float yScale = 5; 
  float distortion = .08; 

  for (int y=0; y<140; y++) {
    for (int x=0; x<140; x++) {
      int index = y * 140 + x;
      float px = positions[index].x; 
      float py = positions[index].y;

      if (mousePressed) {

        float dx = px - mouseX;
        float dy = py - mouseY;
      
      float dh = sqrt(dx*dx + dy*dy); 
      if ( dh > 0) {
        px += distortion * dx/pow(dh, .7);
        py += distortion * dy/pow(dh, .7);
      }}
      //rect(px, py, 1, 1);
      positions[y * 140 + x] = new PVector(px, py);
      rect(positions[index].x, positions[index].y, 1, 1);
    }
  }
}

Comments are closed.