/
Truchet_009.pde
69 lines (59 loc) · 1.45 KB
/
Truchet_009.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
// Truchet Tiles v009
// 26 August 2018
// rupert russell
// artwork available on redbubble at: https://www.redbubble.com/people/rupertrussell/collections/955679-truchet-tiles
int tileSize = 385;
int canvasSize = 7700;
float tileType = 0;
float a, b, c, d, start, stop;
boolean fill = true;
void setup() {
background(255);
size(7700, 7700);
noLoop();
noFill();
strokeWeight(70);
stroke(255,0,0);
}
void draw() {
background(0);
if (fill = true) {
fill(255, 255, 0);
}
for (int i = 0; i < canvasSize; i = i + tileSize) {
for (int j = 0; j < canvasSize; j = j + tileSize) {
tileType = random(0, 1);
if (tileType > 0.5) {
// type 1
a = i;
b = j;
c = tileSize;
d = tileSize;
start = radians(0);
stop = radians(90);
arc(a, b, c, d, start, stop);
a = i + tileSize;
b = j + tileSize;
start = radians(180);
stop = radians(270);
arc(a, b, c, d, start, stop);
} else {
// type 2
a = i + tileSize;
b = j;
c = tileSize;
d = tileSize;
start = radians(90);
stop = radians(180);
arc(a, b, c, d, start, stop);
a = i ;
b = j + tileSize;
start = radians(270);
stop = radians(360);
arc(a, b, c, d, start, stop);
}
}
}
save("Truchet009.png");
exit();
}