-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMoireeRotate.pde
74 lines (49 loc) · 1.23 KB
/
MoireeRotate.pde
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
grid g;
int gridSizeX = 50;
int gridSizeY = 50;
int iterations = 0;
int rotation = 45;
int iterationLimit = 1;
grid[] gridLines = new grid[1000];
void setup(){
background(0);
stroke(255);
size(900,900);
}
void draw(){
if(iterations < iterationLimit){
drawGrid();
rotation += 2;
}
else{
noLoop();
}
}
void drawGrid(){
//######## GRID ########
//Horizontal Lines
for(int i = gridSizeY; i < height; i += gridSizeY){
gridLines[i] = new grid(0, i);
gridLines[i].displayGridVert();
}
//Vertical Lines
for(int i = gridSizeX; i < width; i += gridSizeX){
gridLines[i] = new grid(i, 0);
gridLines[i].displayGridHor();
}
//######## GRID ROTATED ########
for(int i = gridSizeX; i < width; i += gridSizeX){
pushMatrix();
translate(height/2, - height/4);
rotate(radians(rotation));
gridLines[i].displayGridHor();
popMatrix();
}
//for(int i = gridSizeY; i < height; i += gridSizeY){
// pushMatrix();
// translate(width + width/4, height - height / 2);
// rotate(radians(135));
// gridLines[i].displayGridHor();
// popMatrix();
//}
}