@@ -10,12 +10,12 @@ int column_index, row_index;
10
10
float grid_angle, x_step, y_step;
11
11
float position_noise;
12
12
13
- float step_length = 1 ;
13
+ float step_length = 10 ;
14
14
15
15
int _octave = round (random (4 , 6 ));
16
16
float falloff = random (0.75 , 0.8 );
17
- int num_steps = round (random (100 , 200 ));
18
- int num_lines = round (random (400 , 800 ));
17
+ int num_steps = round (random (100 , 150 ));
18
+ int num_lines = round (random (50 , 70 ));
19
19
20
20
void setup () {
21
21
// width, height in pixels
@@ -55,7 +55,7 @@ void setup() {
55
55
}
56
56
57
57
for (int j = 1 ; j < num_lines; j = j+ 1 ) {
58
- float x = random (0 , width );
58
+ float x = random (width / 11 , ( width / 7 ) * 6 );
59
59
float y = random (0 , height );
60
60
float [] point = new float [2 ];
61
61
point[0 ] = x;
@@ -87,6 +87,28 @@ void keyPressed() {
87
87
}
88
88
}
89
89
90
+
91
+ void drawCurves (float x , float y , int left_x , int top_y , float resolution , float [][] grid ) {
92
+ beginShape ();
93
+ for (int i = 0 ; i < num_steps; i = i+ 1 ) {
94
+ vertex (x, y);
95
+ int x_offset = int (x) - left_x;
96
+ int y_offset = int (y) - top_y;
97
+
98
+ column_index = int (x_offset / resolution);
99
+ row_index = int (y_offset / resolution);
100
+
101
+ grid_angle = grid[column_index][row_index];
102
+
103
+ x_step = step_length * cos (grid_angle);
104
+ y_step = step_length * sin (grid_angle);
105
+
106
+ x = x + x_step;
107
+ y = y + y_step;
108
+ }
109
+ endShape ();
110
+ };
111
+
90
112
void exportSVG () {
91
113
int name_falloff = round (falloff * 10 );
92
114
String exportName = _saveName + num_steps + " _" + name_falloff + " .svg" ;
@@ -107,7 +129,8 @@ void exportSVG() {
107
129
108
130
// drawCurves
109
131
for (int i = 0 ; i < num_steps; i = i+ 1 ) {
110
- pg. vertex(x, y);
132
+ int c_size = round (random (4 , 9 ) * (y / 150 ));
133
+ pg. ellipse(x, y, c_size, c_size);
111
134
112
135
int x_offset = int (x) - left_x;
113
136
int y_offset = int (y) - top_y;
@@ -131,24 +154,3 @@ void exportSVG() {
131
154
pg. dispose();
132
155
println (" saved " + exportName);
133
156
}
134
-
135
- void drawCurves (float x , float y , int left_x , int top_y , float resolution , float [][] grid ) {
136
- beginShape ();
137
- for (int i = 0 ; i < num_steps; i = i+ 1 ) {
138
- vertex (x, y);
139
- int x_offset = int (x) - left_x;
140
- int y_offset = int (y) - top_y;
141
-
142
- column_index = int (x_offset / resolution);
143
- row_index = int (y_offset / resolution);
144
-
145
- grid_angle = grid[column_index][row_index];
146
-
147
- x_step = step_length * cos (grid_angle);
148
- y_step = step_length * sin (grid_angle);
149
-
150
- x = x + x_step;
151
- y = y + y_step;
152
- }
153
- endShape ();
154
- };
0 commit comments