SamiaAhmed-Schotter

by Samia @ 7:48 am 12 January 2011

Schotter, processing.js

Schotter, processing

Schotter, openFrameworks

Schotter, code

//Samia Ahmed, samiaa@andrew.cmu.edu
//A reproduction of Schotter by Georg Nees
//Carnegie Mellon University: 51-482
//January 2011
 
  int rows = 23;
  int cols = 12;
  int side;
 
void setup(){
  size(392, 700);
  side = width/(cols+2);
  background(248, 244, 236);
  noLoop();
}
 
void draw(){
  for (int row = 0; row < rows; row++){
    for (int col = 0; col < cols; col++){
      pushMatrix();
      translate((side*col)+side/2+side, (side*row)+side/2+side); //resets the origin
      rotate(setRotation(row, col));
      noFill();
      rect(-(side/2)+setShift(row, col), -(side/2)+setShift(row, col), side, side);
      popMatrix();
    }
  }
 
}
 
float setRotation(int row, int col){
  float count = (row*cols+col);
  float rand = random(count);
  if (count > (rows*cols)/4 || random(rows*cols) < count)
    if (int(random(3)) == 1)
      return radians(90*(rand/(rows*cols)));
    else
     return -radians(90*(rand/(rows*cols)));
  return 0;
}
 
float setShift(int row, int col){
  float count = (row*cols+col);
  float rand = random(count);
  if(count > (rows*cols)/4 || random(row*col) < count)
     if (int(random(3)) == 1)
       return (side/2*(rand/(rows*cols)));
     else
       return -(side/2*(count/(rows*cols)));
  return 0;
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2021 Interactive Art & Computational Design / Spring 2011 | powered by WordPress with Barecity