Joe Medwid – 13-9-65

by Joe @ 2:43 am 24 January 2012

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// Initialize VERY IMPORTANT variables
PVector[] horiz;
 
float currentYHeight;
void setup() {
  size(700, 700);
  background(255);
  smooth();
  noLoop();
  currentYHeight = 0;
    horiz = new PVector[9]; //horiz as in bottom border of line
}
 
 
void draw() { 
 
  // Variables
 
  PVector[] horiz2 = new PVector[9];
  horiz2[0] = new PVector(20, 20);
  float numCircles = random(6,8); 
  float[] sizeMult = {0,(-.5),(.5)};
  float currDist = 660;
  float prevPoint = 20;
  // Box
  rect(20, 20, 660, 660); 
 
  // Circle Construction
  for (int i = 0; i < numCircles; i++){
    float d = random(2,100);
    float xCirc = random(20+(d+1),660-(d+1));
    float yCirc = random(20+(d+1),660-(d+1));
    noFill();
    ellipse(xCirc, yCirc, d, d);
  }  
 
 
   float [] xCoord = new float[9]; //stores values for x lines dividing cols 
   xCoord[8] = 680;
   xCoord[0] = 20;
 
   // Columns
   for (int i = 0; i < 7; i++){ 
     int rand = int(random(1,3));
     float avg = currDist/(8-i);
     float x1 = avg + (avg * sizeMult[rand]);
    //line(prevPoint+x1, 20, prevPoint+x1, 680);
     prevPoint = prevPoint + x1;
     currDist = currDist - x1;
     xCoord[i+1] = prevPoint;
   }
 
  float ranY;
 
   // Make the Lines //
 
   for (int x = 0; x < 10; x++){  // 10 rows // 9
 
       if (x==0){
         //if it's the first iteration then top line is border 
           for (int z = 0; z < 9; z++){ 
             horiz2[z] = new PVector(xCoord[z], 20);}
 
            for (int z =1; z<9; z++) {
              line(horiz2[z-1].x, horiz2[z-1].y, horiz2[z].x, horiz2[z].y);}
       }
       // if it's the last, it's also a border
       if (x==9) {
         for (int z = 0; z < 9; z++){ 
             horiz[z] = new PVector(xCoord[z], 680);}
       }
       else {
           currentYHeight = currentYHeight + random(30,100);
 
          //create horiz 1
           for (int i = 0; i < 9; i++){ 
 
             ranY = currentYHeight - random(-15,15);
             if (ranY  680) {
                     ranY=680;
                 }
 
             horiz[i] = new PVector(xCoord[i], ranY);
             print(horiz2[i] + "vs/.  " +  ranY + "\n");
 
          }
 
           for (int i=1; i<9; i++) {
 
             line(horiz[i-1].x, horiz[i-1].y, horiz[i].x, horiz[i].y);
           }
 
       }
 
       //Fill the boxes with interesting things
       for (int j=0; j= 85){
           // Draw Lines!
         int verticalLinesTotal = int(random(4,11)); 
         for (int i=0; i= 70 && randDraw < 85){
          // Draw Triangles!
            int triangleTotal = int(random(5,10)); 
         for (int i=0; i= 55 && randDraw < 70){
           // Draw Triangles coming from the other direction!
            int triangleTotal = int(random(5,10)); 
         for (int i=0; i<triangleTotal; i++) {
            //find random X
            int ranX = int(random(xCoord[j],xCoord[j+1]));
            int ranX2 = int(random(xCoord[j],xCoord[j+1]));
            int ranX3 = int(random(xCoord[j],xCoord[j+1]));
 
            float m1 = (horiz2[j+1].y - horiz2[j].y) / (horiz2[j+1].x - horiz2[j].x);
            float topY = (m1*(ranX-horiz2[j].x)) + horiz2[j].y;
 
            float m2 = (horiz[j+1].y - horiz[j].y) / (horiz[j+1].x - horiz[j].x);
            float bottomY1 = (m2*(ranX2-horiz[j].x)) + horiz[j].y;
            float bottomY2 = (m2*(ranX3-horiz[j].x)) + horiz[j].y;
            triangle(ranX, topY, ranX2, bottomY1, ranX3, bottomY2);
 
          }
         }
       }
 
         println();
       //Switch up horiz and horiz2
       horiz2 = horiz;
       horiz = new PVector[9];
 
    }
 
}

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