Skip to content

Commit b2ae946

Browse files
committed
use circles instead of lines
1 parent 7abc9fd commit b2ae946

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

flow_field/flow_field.pde

+28-26
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ int column_index, row_index;
1010
float grid_angle, x_step, y_step;
1111
float position_noise;
1212

13-
float step_length = 1;
13+
float step_length = 10;
1414

1515
int _octave = round(random(4, 6));
1616
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));
1919

2020
void setup() {
2121
// width, height in pixels
@@ -55,7 +55,7 @@ void setup() {
5555
}
5656

5757
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);
5959
float y = random(0, height);
6060
float[] point = new float[2];
6161
point[0] = x;
@@ -87,6 +87,28 @@ void keyPressed() {
8787
}
8888
}
8989

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+
90112
void exportSVG() {
91113
int name_falloff = round(falloff * 10);
92114
String exportName = _saveName + num_steps + "_" + name_falloff + ".svg";
@@ -107,7 +129,8 @@ void exportSVG() {
107129

108130
// drawCurves
109131
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);
111134

112135
int x_offset = int(x) - left_x;
113136
int y_offset = int(y) - top_y;
@@ -131,24 +154,3 @@ void exportSVG() {
131154
pg.dispose();
132155
println("saved " + exportName);
133156
}
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

Comments
 (0)