Untitled 4 Random Experimentantions

Iuri Kato


Based on: Untitled 4 by Reiner Schneeberger, 1978

Category: experimental


Description:

Added randomizations to the Direct Translation on the gridSize and density variables. Every "Run" builds a different image. This sketch is running in the browser.






/* 
Part of the ReCode Project (http://recodeproject.com)
Based on "Untitled 4" by Reiner Schneeberger
Originally published in "Computer Graphics and Art" v3n2, 1978
Copyright (c) 2014 Iuri Kato - OSI/MIT license (http://recodeproject/license).
*/

/* @pjs pauseOnBlur="true"; */

/* 
Part of the ReCode Project (http://recodeproject.com)
Based on "Untitled 4" by Reiner Schneeberger
Originally published in "Computer Graphics and Art" vol3 no2, 1978
Copyright (c) 2012 Jon Bobrow - OSI/MIT license (http://recodeproject/license).
*/
// 
// Untitled #5 is part of a 10 piece series, intended to test viewers
// perception of art and composition. The section is titled "Experimental
// Esthetics with Computer Graphics -- Analyses of Viewers Impressions 
// of Computer Graphics."
//
//
// note: .f enforces float division, dividing by an int would automatically round down
// i.e. 1/2 = 0 , 1/2.f = .5

int gridSize = random(30);
int density = random(7);

// interesting density for grid 20: 2.5; 3.5; 5.3; 6.02;

void setup(){
  size(400,400);
  background(255);
  
  stroke(0);
  strokeWeight(1);
  float padding = gridSize/(float)density;    // even spacing for lines
          
  int rows = height/gridSize;
  int cols = width/gridSize;
  
  for(int i = 0; i < rows; i++){        // iterate over the # of rows (top to bottom)
    for(int j = 0; j < cols; j++){      // iterate over the # of columns (left to right)
      
      pushMatrix();
      translate(j*gridSize, i*gridSize);      // move to grid location
      translate(gridSize/2.f, gridSize/2.f);  // move to rotate around center
      if(random(1) < .5) 
        rotate(PI/2);        // rotate vertical or horizontal
      else 
        rotate(PI);
      
      for(int k = 0; k < density; k++){          // draw # of lines based on density with even spacing
        float _x = (k - density/2.f) * padding;  
        line(_x, -gridSize/2.f, _x, gridSize/2.f);
        //rect(_x, -gridSize/2.f, 5,5) //checking start position of the line
      }
      popMatrix();
    }
  }
}