Kaushal Agrawal 13-9-65

by kaushal @ 9:59 pm 23 January 2012

//Number of rows and coloums in the patterns;
int pRow = 10; 
int pCol = 8;
int[][] pattern = new int[pRow][pCol];
int numXPoints,numYPoints;
PVector[][] gridPoints;
int initX, initY, aWidth, aHeight;
 
void setup(){
  size(600,650);
  background(255);
  smooth();
  numXPoints = pCol+1;
  numYPoints = pRow+1;
  initX = 50; initY = 50; aWidth=500; aHeight=500;
  gridPoints = new PVector[numYPoints][numXPoints];
  noFill();
  rect(initX,initY,aWidth,aHeight);  
 
   //Initialization
  gridPoints[0][0]=new PVector(initX,initY);
  int cellWidth = aWidth/pCol;
  int cellHeight= aHeight/pRow;
 
  //Determining the location of the points for the first row
  for(int j=1;j<numXPoints-1;j++)
    gridPoints[0][j]=new PVector(gridPoints[0][j-1].x+random(cellWidth-(cellWidth/2),cellWidth+(cellWidth/2)),gridPoints[0][j-1].y);
  gridPoints[0][numXPoints-1]=new PVector(initX+aWidth, initY);
 
  //Getting the location of points for the entire Art
  for(int i=1;i<numYPoints;i++){
    if(i==(numYPoints-1))
      gridPoints[i][0]=new PVector(gridPoints[i-1][0].x,initY+aHeight);
    else
      gridPoints[i][0]=new PVector(gridPoints[i-1][0].x,gridPoints[i-1][0].y+random(cellHeight-(cellHeight/4),cellHeight+(cellHeight/4)));
    for(int j=1;j<numXPoints;j++){
 
      int deviation = (int)random(-10,10);
      gridPoints[i][j]=new PVector();
      gridPoints[i][j].x=gridPoints[i-1][j].x;
      if(i==(numYPoints-1))
        gridPoints[i][j].y=gridPoints[i][j-1].y;
      else
        gridPoints[i][j].y=gridPoints[i][j-1].y+deviation;
      line(gridPoints[i][j-1].x,gridPoints[i][j-1].y,gridPoints[i][j].x,gridPoints[i][j].y);
    }
  }
 
  for(int i=0;i<pRow;i++){
    for(int j=0;j<pCol;j++){
      pattern[i][j]=(int)random(0,3);
    }
  }
  noLoop(); 
}
 
 
void draw(){
  for(int m=0;m<pCol;m++){
    int k = 0;
    while(k<pRow){
      int choice = pattern[k][m];
      //LINES
      if(choice == 1){
        int numLines = (int)random(6,17);
        int temp=k;
        for(int l=0;l<numLines;l++){
          float x = random(gridPoints[k+1][m].x, gridPoints[k+1][m+1].x);
          int z;
          for(z=k;z<pRow;z++){
            if(pattern[z][m]==1){
              int i = z+1;
              int j = m+1;
 
              float m1 = (gridPoints[i-1][j].y - gridPoints[i-1][j-1].y)/(gridPoints[i-1][j].x - gridPoints[i-1][j-1].x);
              float m2 = (gridPoints[i][j].y - gridPoints[i][j-1].y)/(gridPoints[i][j].x - gridPoints[i][j-1].x);
              float y2 = m2*(x-gridPoints[i][j].x)+gridPoints[i][j].y;
              float y1 = m1*(x-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
              line(x,y1,x,y2);
            }
            else{
              temp = z;
              break;
            }
          }
          temp=z;
        }
        k=temp;
      }
 
      //TRIANGLES
      else if(choice == 2){
        int numTriangles = (int)random(5,13);
        for(int l=0;l0){
            float x = random(gridPoints[i-1][j-1].x, gridPoints[i-1][j].x);
            float y = m1*(x-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
            float x1 = random(gridPoints[i][j-1].x, gridPoints[i][j].x);
            float y1 = m2*(x1-gridPoints[i][j].x)+gridPoints[i][j].y;
            line(x,y,x1,y1);
            float x2 = random(gridPoints[i][j-1].x, gridPoints[i][j].x);
            float y2 = m2*(x2-gridPoints[i][j].x)+gridPoints[i][j].y;
            line(x,y,x2,y2);
          }
 
          //Triangles start from bottom to top
          else{
            float x =  random(gridPoints[i][j-1].x, gridPoints[i][j].x);
            float y = m2*(x-gridPoints[i][j].x)+gridPoints[i][j].y;
            float x1= random(gridPoints[i-1][j-1].x, gridPoints[i-1][j].x);
            float y1 = m1*(x1-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
            line(x,y,x1,y1);
            float x2= random(gridPoints[i-1][j-1].x, gridPoints[i-1][j].x);
            float y2 = m1*(x2-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
            line(x,y,x2,y2);
          }
        } 
        k++;
      }
 
      //BLANK
      else
        k++;
    }
  }
 
  //Draw Circles
  int numCircles = (int)random(8,10);
  for(int l=0;l<numCircles;l++){
    float rad = random(5,70);
    float xc = random(initX+rad,(initX+aWidth-rad));
    float yc = random(initY+rad,(initY+aHeight-rad));
    ellipse(xc, yc, rad, rad);  
  }
}

MahvishNagda-13-9-65

by mahvish @ 7:53 pm





 
boolean getProbTrue(float prob){
  if (random(0, 1) <= prob)
    return true; 
  else 
    return false; 
}
 
int getYatX(int x0, int y0, int x1, int y1, int x){
  return y0 + (((x-x0)*(y1-y0))/(x1-x0)); 
}
 
void setup(){
  size(500, 500); 
}
 
void draw(){
 
  // set up for each frame
  background(255); 
  strokeWeight(1); 
  stroke(0); 
 
  // border
  line(0, 0, 0, height); 
  line(width-1, 0, width-1, height); 
  line(0, 0, width, 0); 
  line(0, height-1, width, height-1);  
 
  float loRange = 0.8; 
  float hiRange = 1.2; 
 
  int[] Xs = new int[9];       // stores the X coordinates for grid
  int[][] Ys = new int[9][9];  // stores the Y coordinates for grid
 
  int[][] fills = new int[9][9]; 
 
  int avXi = width/(Xs.length-1);    // average for each X segment
  int avYi = height/(Ys.length-1);   // average for each Y segment
 
  // get the random X coordinates
  Xs[0] = 0; 
  Xs[Xs.length-1] = width; 
  for(int i=1; i < Xs.length-1; i++){
      Xs[i] = Xs[i-1] + (int) random(loRange*avXi, hiRange*avXi); 
  }
 
  // get the random start Y coordinates
  for(int i=0; i < Ys.length; i++){
    int interval = (int) random(loRange*avYi, hiRange*avYi); 
    if(i==0) 
      Ys[i][0] = interval; 
    else
      Ys[i][0] = Ys[i-1][0] + interval; 
  }
 
  // get all other coordinates
  for(int i=0; i < Ys.length; i++){
    for(int j=1; j < Ys[i].length; j++){
      Ys[i][j] = Ys[i][j-1] + (int) random((loRange-1)*avYi, (1-loRange)*avYi); 
    }
  }
 
  // now let's plot these
  for(int i=0; i < Ys.length; i++){
    for(int j=1; j < Ys[i].length; j++){
      line(Xs[j-1], Ys[i][j-1], Xs[j], Ys[i][j]); 
    }
  }
 
  // choose segment fills
  for(int i=0; i < fills.length; i++){
    for(int j=0; j = 1 && fills[i-1][j] != 1 && 
		fills[i-1][j] != 3 && getProbTrue(0.05)){
          fills[i][j] = 2; 
        } 
        // crossed lines filling 1 segment
        else if(getProbTrue(0.35)){
          fills[i][j] = 3; 
        }
      }
 
    }
  }
 
  // lets add vertical lines   
  for(int i=0; i < Ys.length; i++){
    for(int j=1; j  0 && fills[i][j] == 2){
        numSegments = 2; 
      }
 
      if(numSegments > 0){
 
        // how many lines are we drawing 
        int numLines = (int) random(3, 15);
        if( fills[i][j] == 3) // just many more crossed lines 
           numLines *= 2; 
 
        for (int k=0; k  numSegments-1){ 
            Yks = getYatX( Xs[j-1], Ys[i-numSegments][j-1], 
				Xs[j], Ys[i-numSegments][j], Xk ); 
          }
 
          if(i < Ys.length){
            Yke = getYatX( Xs[j-1], Ys[i][j-1], Xs[j], Ys[i][j], Xe ); 
          }
 
          line(Xk, Yks, Xe, Yke);         
        }
      }
    }
  }
 
  // draw circles 
  for(int i=0; i < random(6,10); i++){
    int randX = (int) random(4, width); 
    int randY = (int) random(4, height); 
 
    int minofCorner = min(randX, randY); 
    minofCorner = min(minofCorner, width - randX); 
    minofCorner = min(minofCorner, height - randY); 
 
    int randRadius = (int) random(4, min(minofCorner, 80)); 
 
    noFill(); 
 
    ellipse(randX, randY, randRadius, randRadius); 
  }
 
  delay(1000); 
 
  if (keyPressed == true) {
    saveFrame("line-####.tif"); 
  }
}

Rothera_alex-13-9-65

by alex @ 7:40 pm

ROTHERA_gaunlet1

///Alex Rothera 1/23/12
 
//Interactive Art and Computational Design
 
 
PVector v1, v2, v3, v4, v5, v6, v7;
 
void setup() {
  size(800, 800);
  smooth();
  background(255);
  frameRate(.2);
  stroke(0);
  strokeWeight(1.5);
}
 
void draw() {
  fill(255);
  rect(0, 0, width, height);
  noFill();
  rect(1, 1, width-3, height-3);
  int overallHorz = floor(random(5, 10));  // # overall divisions
  float horizSpacing = height/overallHorz;  //horizontal spacing distance
  int horizDivisions = 8;
 
 
  PVector [] [] gridXY = new PVector[horizDivisions] [overallHorz];  //2D array to hold ref. points
 
  ///GRID CREATION
  ///establish/store x and y
 
  for (int i=0; i<overallHorz; i++) {
    for (int j=0; j<horizDivisions; j++) {
 
      float tempY = (horizSpacing*i) + random(0, 40);
      float tempX;
 
      if (j==0)  
        tempX=0;
      else if (j==(horizDivisions-1))
        tempX=width;
      else {
        tempX = ((width/horizDivisions) * j) + random(-20, 20);
      }
 
      v1 = new PVector(tempX, tempY);
      gridXY [j][i] =  v1;
    }
  }
 
  /////// //drawing lines (from gridXY points)//////////
  for (int m=0; m<overallHorz; m++) {
    for (int n=0; n<horizDivisions-1; n++) {
 
      v2 = new PVector();
      v2 = gridXY[n][m];
 
      v3 = new PVector();
      v3 = gridXY[n+1][m];
 
      line(v2.x, v2.y, v3.x, v3.y);
    }
  }
 
///////// //***drawing zigzags + straights  ***//////////////
 
  for (int y=0; y<overallHorz-1; y++) {       //for EVERY SECTOR
    for (int z=0; z<horizDivisions-1; z++) {
 
      v4 = new PVector(); 
      v5 = new PVector(); 
      v6 = new PVector(); 
      v7 = new PVector();
      v4 = gridXY[z][y];
      v5 = gridXY[z+1][y];
 
      v6 = gridXY[z][y+1];
      v7 = gridXY[z+1][y+1];
 
      float topSLOPE = (v4.y-v5.y)/(v4.x-v5.x);
      float bottomSLOPE = (v6.y-v7.y)/(v6.x-v7.x);
      //mx+b = y;
      float b1 = v4.y - (topSLOPE*v4.x);
      float b2 = v6.y - (bottomSLOPE*v6.x);
 
 
    //////choosing zigzags, straights, or none
      int decision = floor(random(0, 5));  
      //#0
      //*zig zags*// 
      if (decision == 0) {  
        float numSlashes = random(8, 30);
        for (int g=0; g<numSlashes; g++) {
          float newX = (random(v4.x, v5.x));
          float newX2 = (random(v6.x, v7.x));
          float newY = (topSLOPE*newX) + b1;
          float newY2 = (bottomSLOPE*newX2) + b2;
 
          line(newX, newY, newX2, newY2);
        }
      }
      //#1
      //*straight lines*//
      else if (decision == 1) {
        float numLines = random(5, 18);
        for (int h=0; h<numLines; h++) {
          float newX = (random(v4.x, v5.x));
          float newY = (topSLOPE*newX) + b1;
          float newY2 = (bottomSLOPE*newX) + b2;
 
          line(newX, newY, newX, newY2);
        }
      }
 
      //#2
      //*blank area*//
      else {
        //println("*skip*");
      }
    }
  }
 
  /******/  ////CIRCLES////////********///   
 
  int randCircles = floor(random(3, 11));
 
  for (int q=0; q<randCircles; q++) {
    float randRadius = random(2, 150);
    ellipse(random(0, width), random(0, height), randRadius, randRadius);
  }
}

Sam Lavery – Looking Outwards 1

by sam @ 12:37 pm

Locals and Tourists #2 (GTWA #1): New York

Locals and Tourists by Eric Fischer

This is a map of New York City with a layer of information revealing where tourists and locals take photographs. Tourists are red, locals are blue, and the yellow areas are where both groups mix together. Eric Fischer has created graphics like this for many cities by analyzing thousands of geotagged images from Flickr.com. His program determines if the person who took the picture is from the area or not and creates a dot with the corresponding color. This simple idea reveals a lot about the dynamics of major cities and how “tourist” zones are often compartmentalized from the rest of the city.

Conductor: www.mta.me from Alexander Chen on Vimeo.

Conductor by Alexander Chen

I am a musician and have spent a lot of time in New York so this creation by Alexander Chen really intrigued me. His work, Conductor, takes data from the MTA about when trains are arriving or departing and maps their routes using HTML5 and Javascript. Routes become plucked strings when they intersect each other and the resulting sounds escalate as the time approaches rush hour. The idea that static data such as a train schedule can be manipulated into a dynamic visualization is very inspiring for me. Using this visualization to create music is a great idea that sets a new precedent for how we can experience information. The concept of using senses besides our eyes to experience data is very interesting.

Baroque.me: J.S. Bach – Cello Suite No. 1 – Prelude from Alexander Chen on Vimeo.

Baroque.me: J.S. Bach by Alexander Chen

I will finish this first Looking Outwards with another musical visualization work by Alexander Chen. This project visualizes the first J.S. Bach Cello Suite using 8 lines that act as strings. These strings are plucked by dots rotating on a circle and the strings change length to indicate pitch. This visualization is very effective at revealing the underlying tonal and rhythmic structures of this piece. Music of the Baroque era is very mathematical; this visualization helps to show that there is a constant structure over which Bach wrote this piece. I am all for any visualization that makes something complex, such as musical structures, more comprehensible to the untrained listener.

KelseyLee-FaceOSC

by kelsey @ 3:51 am

Using FaceOSC and Processing I wanted to create an interactive visualization showing the person’s movement about the frame. The Processing file parses the data from FaceOSC and focuses in on the mouth height and eyebrow/eye heights. When the mouth is open past a certain threshold, stars are generated on the canvas. Meanwhile, raising the eyebrows will change the color of the stars that are to be generated next. Scale is also taken into account, with the person being closer to the screen resulting in larger stars.

The circle on the canvas indicates where the stars will originate, and maps to the person’s nose position. Each star has a designated “life”, so that eventually they will dissipate, allowing screen space to be freed up, however until then they will bounce about the screen, rebounding off the bounds of the frame.

[youtube=https://www.youtube.com/watch?v=TajOcZieAwI&feature=youtu.be]
In version 2, I instead had a background fill that was partially transparent, allowing the stars’ trails to be evident however, eventually fading out after many semi-opaque layers pile up.
[youtube=https://www.youtube.com/watch?v=YtHuzdiL0dI&feature=youtu.be]

SankalpBhatnagar-13-9-65

by sankalp @ 3:46 am

Hello, this is Part 2 of my Project 1 (Guantlet) where I was to reproduce the 1965 Plotter work, 13/9/65 Nr.2, by Frieder Nake in my own preferred programming enviornment. I chose Processing. Striving for an accurate reproduction definitely took me quite a while. Enjoy!

 

You can take a look at my code below:

void setup()
{
  size(899,935);
  background(255,255,255);
background(255,255,255);
  smooth();
  noFill();
  strokeWeight(2);
}
 
void draw()
{
 
  smooth();
  background(255,255,255);
  drawInitialSquare();
  drawCircles();
 
  //ALL Horizontal Lines
  drawHorizontalLine(20,60,184,43,557,38,620,45,822,24,880,21,880,21,880,21); //first line
  drawHorizontalLine(20,184,191,186,341,200,421,196,585,207,687,178,881,174, 881,174); //second line
  drawHorizontalLine(21,274,184,255,345,266,423,253,584,249,632,262,880,261,880,261); //third line
  drawHorizontalLine(20,349,244,345,436,339,586,323,627,336,690,330,830,340,882,348); //fourth line
  drawHorizontalLine(20,394,186,394,345,379,586,385,629,374,696,378,836,363,881,353); //fifth line
  drawHorizontalLine(20,517,186,516,344,498,426,481,584,478,633,460,689,448,882,450); //sixth line
  drawHorizontalLine(21,575,335,569,426,571,584,564,633,557,688,560,828,545,881,555); //seventh line
  drawHorizontalLine(22,674,204,666,422,657,585,633,628,629,693,627,830,640,882,630); //eighth line
  drawHorizontalLine(23,761,184,753,344,739,426,733,586,742,693,730,823,737,882,734); //ninth line
 
  //ALL Diagonal Clusters
  drawDiagonalsBetween(10,448,16,568,16,448,40,568,39); //between top and first left to right
 
  drawDiagonalsBetween(20,20,60,184,43,20,184,191,186); //between first and second left to right
  drawDiagonalsBetween(10,437,40,579,39,447,197,526,203);
  drawDiagonalsBetween(10, 587, 43, 629, 45, 587, 207, 622, 196);
  drawDiagonalsBetween(20,691,40,880,21,691,178,881,174);
 
  drawDiagonalsBetween(17,587,207,627,197,587,251,627,261); //between second and third left to right
  drawDiagonalsBetween(20,699,178,881,174,699,262,881,261);
 
  drawDiagonalsBetween(30,20,275,181,257,20,348,175,345); //between the third and fourth left to right
  drawDiagonalsBetween(15, 343,267,420,255,343,342,425,339);
  drawDiagonalsBetween(15,468,254,583,249,477,335,576,323);
  drawDiagonalsBetween(30,629,262,688,262,629,336,688,330);
  drawDiagonalsBetween(10,693,263,810,261,715,332,794,338);
 
  drawDiagonalsBetween(20,20,350,170,348,20,394,182,394); //between the fourth and fifth left to right
  drawDiagonalsBetween(20,343,343,420,341,342,378,427,381);
 
  drawDiagonalsBetween(10,346,380,392,381,349,495,426,479);//between the fifth and sixth left to right
  drawDiagonalsBetween(10,630,375,688,379,630,459,688,449);
  drawDiagonalsBetween(20,697,380,827,365,693,448,820,448);
 
  drawDiagonalsBetween(10,195,515,339,500,201,572,338,568);//between the sixth and seventh left to right
  drawDiagonalsBetween(10,349,497,423,482,360,569,421,569);
  drawDiagonalsBetween(20,587,478,629,463,590,563,629,558);
 
  drawDiagonalsBetween(15,21,575,174,573,21,674,130,669);//between the seventh and eigth left to right
  drawDiagonalsBetween(15,337,569,426,572,338,660,427,656);
  drawDiagonalsBetween(20,631,558,693,562,630,628,693,627);
 
  drawDiagonalsBetween(10,235,665,337,661,195,753,329,741);//between the eigth and ninth left to right
  drawDiagonalsBetween(10,453,654,576,634,436,733,582,742);
 
  drawDiagonalsBetween(20,719,733,826,739,701,878,828,876); //between the ninth and bottom
 
  //ALL Vertical Clusters
  drawVerticalsBetween(10,655,42,684,40, 655,262,684,262);  //between first and third lines left to right
 
  drawVerticalsBetween(15,341,200,421,196,341,266,421,253); //between second and third lines left to right
  drawVerticalsBetween(20,20,184,164,186,20,274,164,258);
  drawVerticalsBetween(15,530,204,555,206,530,250,555,249);
 
  drawVerticalsBetween(10,594,326,623,335,494,410,623,374); //between fourth and fifth left to right
  drawVerticalsBetween(20,709,332,828,341,709,376,828,365);
 
  drawVerticalsBetween(30,444,339,532,329,444,479,532,479); //between fourth and sixth left to right
 
  drawVerticalsBetween(10,186,395,229,391,186,514,229,510); //between fifth and sixth left to right
  drawVerticalsBetween(20,256,388,334,381,258,506,334,499);
 
  drawVerticalsBetween(30,834,365,882,353,834,546,882,556);//between fifth and seventh left to right
 
  drawVerticalsBetween(20,201,573,305,571,201,665,305,661); //between seventh and eigth left to right
  drawVerticalsBetween(30,336,570,425,571,336,660,425,657);
  drawVerticalsBetween(30,438,572,579,566,438,654,579,633);
 
  drawVerticalsBetween(15,341,660,427,656,341,738,427,732); //between eigth and ninth left to right
  drawVerticalsBetween(30,704,628,811,639,704,730,811,736);
  drawVerticalsBetween(20,831,640, 882,631,831,735,882,733);
 
  drawVerticalsBetween(10,586,633,628,630,586,877,633,877); //between eighth and bottom left to right
 
  noLoop();
  println("Finished.");
  exit();
}
 
//initial square
void drawInitialSquare()
{
  line(20,20,880,13);
  line(20,20,23,882);
  line(23,882,883,876);
  line(883,876,880,13);
}
 
void drawHorizontalLine(int a, int A, int b, int B, int c, int C, int d, int D, int e, int E, int f, int F, int g, int G, int h, int H)
{
  line(a,A,b,B);
  line(b,B,c,C);
  line(c,C,d,D);
  line(d,D,e,E);
  line(e,E,f,F);
  line(f,F,g,G);
  line(g,G,h,H);
}
 
void drawVerticalsBetween(float n,float a, float A, float b, float B, float c, float C, float d, float D)
{
  for(float i=a; i<b ; i=i+random(1,n))
  {
    float temp1= findY(i,a,A,b,B);
    float temp2= findY(i,c,C,d,D);
    line(i,temp1,i,temp2);
  }
 
}
 
void drawDiagonalsBetween(float n, float a, float A, float b, float B, float c, float C, float d, float D)
{
  for (int i = 0; i < n; i++)
  {
    float x1 = random(a,b);
    float x2 = random(c,d);
    float y1 = findY(x1,a,A,b,B);
    float y2 = findY(x2,c,C,d,D);
    line(x1,y1,x2,y2);
  }
}
 
float findY(float X, float xi, float yi, float xf, float yf)
{
  float s= (yf-yi)/(xf-xi);
  float Y= s*(X-xi)+yi;
  return(Y);
}
 
void drawCircles()
{
  ellipse(69,59.5,39,39);
  ellipse(839,81,66,66);
  ellipse(232,237,83,83);
  ellipse(269,422,44,44);
  ellipse(376,435,128,128);
  ellipse(26,477,6,6);
  ellipse(236,663,131,131);
  ellipse(328,734,42,42);
}

KelseyLee-13-9-65

by kelsey @ 3:42 am

 

Using Processing, I tried to replicate the piece 13/9/65 Nr. 2, by Frieder Nake . By storing all of the points in arrays to access later, I was able to slow down the output so that you can see each line being drawn.

/*
 *Kelsey Lee 13/9/65 Nr. 2, by Frieder Nake (born 1938, Germany)
 *trying to replicate  13/9/65 Nr. 2, by Frieder Nake (born 1938, Germany)
 *randomly selects widths of columns
 *randomly selects where to place horizontal lines, width of segments & incline/decline of those segments
 *will then chose whether the block created by the column/horizontal line barriers should contain 
 *straight lines, triangles/angles or nothing - if trianlges will choose whether to originate from top or bottom
 *when done, will randomly select number of circles, radius of circles and placement of circles
 *
 *  ***will draw it line by line so you can see process***
 */
 
int WIN_WIDTH = 600;
 
int COLS;
int CUBE_WIDTH_MIN = 30;
int CUBE_WIDTH_MAX = 80;
 
int[]colSegments = new int[int(WIN_WIDTH/CUBE_WIDTH_MIN)+1];
 
horizLine startHorizLine;
horizLine endHorizLine;
horizLine screenBottom;
 
vertLineHolder vertHolder;
vertLineSeg vertSeg;
 
int ctr;
int horizCtr;
int yHeight;
int circleCtr;
int numCircles;
 
String phase;
boolean moreVert;
boolean lastLine;
 
int CUBE_HEIGHT_START_MIN = 60;
int CUBE_HEIGHT_START_MAX = 100; //prior to sloping lines up or down
 
void setup(){
  size(WIN_WIDTH, WIN_WIDTH); //create window
  stroke(0);
  strokeWeight(1.5);
  smooth();
  background(255); 
  frameRate(40);
   yHeight =  0;
   lastLine = false;
 
   startHorizLine = new horizLine(0);
   startHorizLine.createTop();
 
   screenBottom = new horizLine(WIN_WIDTH);
   screenBottom.createBottom();
 
   //find column widths
   colSegments[0] = int(random(CUBE_WIDTH_MIN,CUBE_WIDTH_MAX)); //generates first cube width
   ctr=1;
   COLS=0;
   //randomly chose width of column until nearly at edge of screen, make sure last column is at least min cube width
   while ((colSegments[ctr-1]+CUBE_WIDTH_MIN)  endHorizLine.numPts) {
           phase="startVertSeg";
        }
    }  
    else if (phase == "startVertSeg") {
        vertHolder = new vertLineHolder(startHorizLine, endHorizLine);
        moreVert = vertHolder.drawLine();
        phase = "continueVertSeg"; 
    }
    else if (phase == "continueVertSeg") {
       moreVert = vertHolder.drawLine();
       if (moreVert == false) {
        // print("end vert seg\n");
         phase = "endVertSeg"; 
       }
    }
    else if (phase == "endVertSeg") {
       phase = "endHorizLineBegin";
       startHorizLine = endHorizLine; //now the bottom horizontal line is the starting horizontal line for the next iteration
       yHeight += int(random(int(WIN_WIDTH/10),int(WIN_WIDTH/8))); //choose starting height of the next line 
       if (lastLine == true) {
        phase = "circles"; 
       }
       if((yHeight+CUBE_HEIGHT_START_MAX+(CUBE_HEIGHT_START_MAX/5)) >= WIN_WIDTH) {
          lastLine = true;
       }
    }
    else if (phase == "circles") {
      boolean endOfCircles = makeCircles(); // draw circles
      if (endOfCircles == true) {
        phase="completed";
      }
  }
 
  if (phase == "completed"){
    noLoop();
  }
}
 
 
 
//make line equation from horizontal line of points and plug in known xVal to find the yVal
float findYVal(int xVal, int[][]horizLine) {
   int ctr = 0;
   boolean foundY = false;
   float yVal =0;
 
  //find which column this xVal is in
  while (foundY == false) {
    //if true, xVal is in this column
     if (xVal >=  horizLine[ctr][0] && xVal <= horizLine[ctr][2]) {  
       //line eq, plug in x 
       yVal = float(horizLine[ctr][3]-horizLine[ctr][1])/float(horizLine[ctr][2]-horizLine[ctr][0])*float(xVal-horizLine[ctr][2]) +horizLine[ctr][3];
       foundY=true;
      }
      else {
        ctr++; 
      }
  }
  return yVal;
}
 
/* 
 * structure that holds a whole row's worth of vertical line segments
 * keeps track of which segment is being drawn & which line in that segment is being drawn.
 * creates many vertLineSeg structures which contain the points of all vertical lines to be drawn
 */
class vertLineHolder{
  vertLineSeg[] segs = new vertLineSeg[COLS]; //holds vertical line segments
  horizLine startLine; 
  horizLine endLine;
  int col; //for total number of columns
  int currentCol; //used later to iterate through all columns
  int currentLine; //keeps track of which line in a segment is being drawn
 
  //constructor
  vertLineHolder(horizLine startHorizLine, horizLine endHorizLine){
      startLine = startHorizLine;
      endLine = endHorizLine;
      col = 0; 
      int vertLineStart = 0;
      currentCol = 0;
 
      //now create segments for whole row; randomize type of vertical lines for segment
      while (colSegments[col+1] < WIN_WIDTH) {
       // print("col: " +col);
         int vertLineEnd = colSegments[col];
 
         int pattern = int(random(0,8)); //0,1 -vert lines; 2,3 - triangles, 4-8 -empty makes it  5/8ths likely that nothing will be drawn
         //when creating vertLineSeg, call that constructor to choose lines
         if (pattern  segs[currentCol].numLines-1) {
      //  print("from check to next col update col \n\n");
         currentLine=0;
         currentCol+=1; 
      }
    }
 
    //if now onto a column that exceeds the number of columns present, then must go to next row to draw
    if (currentCol >= COLS) {
   //   print("resetCol \n");
        currentCol = 0;
       return false; //meaning row is done being drawn
    }
    else {
      return true; //row is not done being drawn
    }
  }
}
 
 
//a single segment of vertical lines
class vertLineSeg {
  int numLines;
  int type; //type of lines
  int vertSeg;
  int vertStart; // value of starting x
  int vertEnd; // valiue of ending x
  float [][]segPts; // array of points for this segment
  int currentLine; //current line being drawn
 
 
   vertLineSeg(horizLine startHorizLine, horizLine endHorizLine, int t, int vertLineStart, int vertLineEnd) {
      type = t; // for straight or angled lines
      vertSeg = 0;
      vertStart = vertLineStart; // value of starting X
      vertEnd = vertLineEnd; //value of ending X
 
      currentLine =0; //current Line being created
 
      int lineCtr = 0; // the line being drawn
      numLines = int(random(1,(vertEnd-vertStart)/6)); //arbitrary 6 - total number of lines/angles for this seg,ent
 
      segPts = new float[(numLines*2)][4]; //array of points
 
 
 
      if (type == 1) { // straight lines
      //print(" lines: " + numLines + " | ");
       while (lineCtr  WIN_WIDTH) {
               startXVal=WIN_WIDTH;  //don't draw past end of screen
          }
          float yValStart = findYVal(startXVal, startHorizLine.horizPts);
          float yValEnd = 0;
 
          yValEnd = findYVal(startXVal, endHorizLine.horizPts);
          //store values
          segPts[lineCtr][0] = segPts[lineCtr][2] = startXVal;
          segPts[lineCtr][1] = yValStart;
          segPts[lineCtr][3] = yValEnd;
          lineCtr+=1; //increment to create next line
       }
 
      }
      else if (type==2) { //create angles starting from top
        numLines *=2;  // will need to store double the amount of lines b/c 2 lines for angle
     //   print(" lines: " + numLines + " | ");
        while ((lineCtr+2)  WIN_WIDTH) {
               startXVal=WIN_WIDTH;  //don't draw past end of screen
          }
          float yValStart = findYVal(startXVal, startHorizLine.horizPts);
          float yValEnd = 0;
          //create both lines of angle
          for (int i=0; i WIN_WIDTH) {
                   endXVal=WIN_WIDTH; 
               }    
                yValEnd = findYVal(endXVal, endHorizLine.horizPts);
 
                segPts[lineCtr][0] = startXVal;
                segPts[lineCtr][1] = yValStart;
                segPts[lineCtr][2] = endXVal;
                segPts[lineCtr][3] = yValEnd;
                lineCtr+=1;
          }
       }
      }
      else if (type == 3) { // create angles starting from bottom
        numLines *=2; 
     //   print(" lines: " + numLines + " | ");
        while ((lineCtr+2)  WIN_WIDTH) {
               startXVal=WIN_WIDTH;  //don't draw past end of screen
          }
          float yValStart = findYVal(startXVal, endHorizLine.horizPts);
           float yValEnd = 0;
          for (int i=0; i WIN_WIDTH) {
                   endXVal=WIN_WIDTH; 
               }    
               yValEnd = findYVal(endXVal, startHorizLine.horizPts); //ending yVals are on the top horizontal line
 
                segPts[lineCtr][0] = startXVal;
                segPts[lineCtr][1] = yValStart;
                segPts[lineCtr][2] = endXVal;
                segPts[lineCtr][3] = yValEnd;
                lineCtr+=1;
          }
        }
      }
 //  print( "\n");
 } 
}
 
//creates a horizontal line
class horizLine {
   int[][]horizPts = new int[10][4]; // stores points for horiz line
   int numPts;
   int minStartY; // starting Y
   int horizCtr; //number of horiz segments
 
   horizLine (int y){
      numPts = 0;
      minStartY = y;
      horizCtr=0;
   } 
 
   //line for top of screen
   void createTop() {
     horizPts[0][0] = horizPts[0][1] = horizPts[0][3] = 0;
     horizPts[0][2] = WIN_WIDTH;
   }
 
   //line for bottom of screen
   void createBottom() {
     horizPts[0][0]= 0;
     horizPts[0][1] = horizPts[0][2] = horizPts[0][3] = WIN_WIDTH;
   }
 
   // all other lines
   void createLine(){
     int remainingWidth = WIN_WIDTH;
 
      //starting coordinate
      int startX=0; 
      int startY = minStartY + int(random(CUBE_HEIGHT_START_MIN ,CUBE_HEIGHT_START_MAX));
 
      //line can slope up or down only w/in the following range - so as not to allow the horizontal lines to intersect with each other
      int minY = startY - ((startY-minStartY)/5); 
      int maxY = startY + ((startY-minStartY)/5);
      numPts = 0;
      while (remainingWidth > 0) {
        //find ending point for hte line segment
        int endX = startX + int(random(CUBE_HEIGHT_START_MIN ,CUBE_HEIGHT_START_MAX));
        //if chosen end X coordinate is past the end of the screen, reset to end of screen
        if (endX > WIN_WIDTH || (endX+CUBE_WIDTH_MIN)>WIN_WIDTH) {
          endX = WIN_WIDTH;
         }
         //will this segment of line slope up (0) or down (1)
         int sign = int(random(0,1));
         int endY;
         if (sign == 0 ) {
           endY = int(random(minY, maxY));
          }
          else {
            endY = -1*int(random(minY, maxY));
          }
          //store that line segment
          horizPts[numPts][0] = startX;
          horizPts[numPts][1] = startY;
          horizPts[numPts][2] = endX;
          horizPts[numPts][3] = endY;
          numPts+=1;
 
          remainingWidth = WIN_WIDTH - endX;
          ctr+=1;
          //end point from previous segment becomes the start of the next
          startX = endX;
          startY = endY;
        }
       }
 
       int[][] getLine() {
          return horizPts; 
       }
 
}
 
 
//draw circles, xVal of center will fall inside a column
boolean makeCircles() {
  fill(255, 0);
 
  //randomly choose number of circles
 
  if (circleCtr < numCircles) {
    //randomly choose radius
    int circleRadius = int(random(CUBE_WIDTH_MIN,200))/2;
    int cubeNum  = int(random(1,COLS));
    int xCoord= int(random(colSegments[cubeNum-1],colSegments[cubeNum]));
    ellipse(xCoord, int(random(circleRadius,WIN_WIDTH-circleRadius)), circleRadius, circleRadius);
    circleCtr++;
  } 
  else {
   return true; 
  }
  return false;
}

Zack J-W Look Out! – 3

by zack @ 12:22 am

Looking outward….

[youtube https://www.youtube.com/watch?v=_2qPWc32LS8]

Looking outward…
[youtube https://www.youtube.com/watch?v=KVIgMb8PdIA]

Looking outward…
[youtube https://www.youtube.com/watch?v=k-GFxvbTJG0]

Moving on.

Heather Knight – 13-9-65

by heather @ 11:34 pm 22 January 2012

  

In this program, I attempt to recreate the experience of witnessing Frieder Nake’s “13/9/65 Nr. 2” come to life. My functions create X-Y paths for the plotter pixel by pixel, and are mutually inspired the line-thicknesses and supporting-structures of a 3D-printer (hence the initial outline, and the white dot left each time the ‘nozzle’ is lifted). I wanted to create a modern-day instantiation and took poetic license with the simplifications of resulting forms. The most challenging part was deriving how to draw a circle without using a pre-built function, for which I borrowed an early computer graphics technique called the Midpoint Circle Algorithm.

[vimeo=https://vimeo.com/35554900]

Above you find a demo video of the program. My browser couldn’t handle my .jar but the file is here. Please find my code below. To run the program with full effect, download the printer soundclip here.

//Heather Knight - HW2.2 - "13-9-65" Plotter

import ddf.minim.*;

// states
boolean draw_outline=true;
boolean draw_lines=false;
boolean next_vertical = false;
boolean next_horizontal = false;
boolean carriage_return = false;
boolean next_circle=false;
boolean next_blip = false;
boolean done = false;

// screen variables
int x=0;
int y=0;
int w=640;
int h=480;
int liw=8; //linewidth

// function variables
int i=0;
int hjump=0;
int minjump=15;
int blipval = 0;
int circleval = 0;
int savey=0;
int savex=0;
boolean error=false;
boolean first = true;

// circle variables
int[] xarray = new int[1];
int[] yarray = new int[1];
int numpix=0; //number pixels per octant
int radius;
int rad_sq;
int j=0;
int center_x;
int center_y;

//sound
Minim minim;
AudioPlayer player;

void setup() {
  // set draw characteristics
  fill(255);
  // setup window
  size(w+liw, h+liw);
  //setup sound
  minim = new Minim(this);
  player = minim.loadFile("printer.wav");
  player.loop();
  println("Setup Complete");
}

void draw() {
  i += 1;
  //println(i);
  if (draw_outline) {
    if (!first&&(x==0)&&(y==0)) {
      draw_outline=false;
      draw_lines=true;
      next_vertical=true;
    }
    else if ((x<w)&&(y==0)) {
      x = x + 1;
      first = false;
      //println("top");
    }
    else if ((x==w)&&(y0)) {
      x = x - 1;
      //println("bottom");
    }
    else if ((x==0)&&(y>0)) {
      //println("leftside");
      y = y - 1;
    }
    else{
      error=true;
      println("error");
    }
  }
  else if (draw_lines) {
    if(next_vertical){
      if(y==h){
        player.close();
        println("done");
        next_vertical=false;
        done = true;
      }
      else{
        hjump=int(random(h)/3);
        if(hjumph){
          println("jump down!");;
          hjump = h-y;
          y=h;
        }else{
          y=y+hjump;
        }
        next_vertical=false;
        next_horizontal=true;
      }
    }
    else if(next_horizontal){
      blipval = int(random(100));
      if (x==w){
        next_horizontal=false;
        carriage_return=true;
      }
      else if (blipval < 2){
        //randomly decide on brips travel up
        println("blip!");
        savey=y;
        next_blip = true;
        next_horizontal = false;
      }
      else{
        //travel horizontally
        x+=1;
      }
    }
    else if(next_blip){
      if(y==(savey-hjump)){
      y=savey;
      next_blip=false;
      next_horizontal=true;
      }
      else{
        y=y-1;
      }
    }
    else if(carriage_return){
      circleval = int(random(1000));
      if (x==0){
        carriage_return=false;
        next_vertical=true;
      }
      else if (circleval < 2){
        //randomly decide on brips travel up
        println("circle!");
        //circle inits
        center_y=x;
        center_x=y-hjump/2;
        radius=hjump/2;
        if(((center_x+radius/2)=0)&((center_y+radius/2)=0)){
          savey=y;
          savex=x;
          next_circle = true;
          calc_circle(radius);
          carriage_return = false;
        }
      }
      else{
        //travel horizontally back to zero
        x-=1;
      }
    }
    else if(next_circle){
      j+=1;
      if(j<numpix){
        println("j="+j+" yval="+yarray[j]+" xval="+xarray[j]);
        ellipse(yarray[j]+center_y,xarray[j]+center_x,liw,liw);
        if(j==numpix-1){
        println("octant1 done");
        }
      }
      else if(j<numpix*2){
        ellipse(xarray[numpix-(j-numpix)-1]+center_y,yarray[numpix-(j-numpix)-1]+center_x,liw,liw);
        if(j==numpix*2-1){
          println("octant2 done");
        }
      }
      else if(j<numpix*3){
        ellipse(xarray[j-numpix*2]+center_y,-yarray[j-numpix*2]+center_x,liw,liw);
        if(j==numpix*3-1){
           println("octant3 done");
        }
      }
      else if(j<numpix*4){
        ellipse(yarray[numpix-(j-numpix*3)-1]+center_y,-xarray[numpix-(j-numpix*3)-1]+center_x,liw,liw);
        if(j==numpix*4-1){
           println("octant4 done");
        }
      }
      else if(j<numpix*5){
        ellipse(-yarray[j-numpix*4]+center_y,-xarray[j-numpix*4]+center_x,liw,liw);
        if(j==numpix*5-1){
           println("octant5 done");
        }
      }
      else if(j<numpix*6){
        ellipse(-xarray[numpix-(j-numpix*5)-1]+center_y,-yarray[numpix-(j-numpix*5)-1]+center_x,liw,liw);
        if(j==numpix*6-1){
          println("octant6 done");
        }
      }
      else if(j<numpix*7){
        ellipse(-xarray[j-numpix*6]+center_y,yarray[j-numpix*6]+center_x,liw,liw);
        if(j==numpix*7-1){
          println("octant7 done");
        }
      }
      else if(j=radius/2){
      yy=yy+1;
      xx=int(sqrt(rad_sq-yy*yy));
      xarray=append(xarray, xx);
      yarray=append(yarray, yy);
  } 

  println("xarray.length "+xarray.length);
  numpix=xarray.length;
  j=0;
}

void stop()
{
  //player.close();
  minim.stop();
  super.stop();
}

 

Zack J-W Look Out! – 2

by zack @ 11:33 pm

For a time, it was good.  Then, seeds of dissent began to take root….at Gooski’s.

Ping pong playing robots have come a long way.  I can remember when ping pong playing robots were little more than a box holding a paddle and connecting with about 10% of incoming traffic.  Well, cousin, those days are over.
[youtube https://www.youtube.com/watch?v=vkk8kMm08cA]

I look forward to the days when they begin competing with humans.  And then beating them.  The first league of biological and artificial athletes.  Boy, won’t that be something?  A second Renaissance. Utopia. How could it possibly go wrong?

« Previous PageNext Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2023 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity