new: outlined squareGen
This commit is contained in:
parent
3828de6d0b
commit
9f0eb4a149
|
@ -1,6 +1,9 @@
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
int size = 250;
|
int size = 250;
|
||||||
int weight = 20;
|
int weight = 20;
|
||||||
int gridSize = 20;
|
int cellSize = 20;
|
||||||
|
int gridSize = 5;
|
||||||
int repetitions = int(random(5));
|
int repetitions = int(random(5));
|
||||||
int dir = int(random(0, 2));
|
int dir = int(random(0, 2));
|
||||||
|
|
||||||
|
@ -20,7 +23,38 @@ void draw() {
|
||||||
stroke(0);
|
stroke(0);
|
||||||
strokeWeight(weight/2);
|
strokeWeight(weight/2);
|
||||||
//fill(255);
|
//fill(255);
|
||||||
float startX = centerW + weight;
|
//float startX = centerW + weight;
|
||||||
float startY = centerH + weight;
|
//float startY = centerH + weight;
|
||||||
line(startX, startY, startX + (gridSize*repetitions*(1-dir)), startY + (gridSize*repetitions*dir));
|
//line(startX, startY, startX + (gridSize*repetitions*(1-dir)), startY + (gridSize*repetitions*dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
class Grid {
|
||||||
|
grid = int[gridSize][gridSize];
|
||||||
|
|
||||||
|
void fillGrid() {
|
||||||
|
// pick a random empty cell
|
||||||
|
int X = int(random(0, gridSize));
|
||||||
|
int Y = int(random(0, gridSize));
|
||||||
|
// pick a length for the line
|
||||||
|
int len = int(random(0, 5));
|
||||||
|
// choose a direction to extend the 'head' of the line from
|
||||||
|
int dir = int(random(0, 4));
|
||||||
|
|
||||||
|
// repeat until length of line is reached
|
||||||
|
// repeat until grid is filled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Line {
|
||||||
|
LinkedList line = new LinkedList();
|
||||||
|
|
||||||
|
void add(int point) {
|
||||||
|
line.add(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
// for each point in the list
|
||||||
|
// draw a line for each adjacent point
|
||||||
|
// translate it to the screen position
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue