-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBlender.java
38 lines (33 loc) · 863 Bytes
/
Blender.java
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
public class Blender implements Runnable {
public static final Colour[][][] colours = new Colour[100][100][100];
@Override
public void run() {
var id = new Colour(0, 0, 0);
for (int x = 0; x < colours.length; x++) {
Colour[][] plane = colours[x];
for (int y = 0; y < plane.length; y++) {
Colour[] row = plane[y];
for (int z = 0; z < row.length; z++) {
Colour colour = new Colour(x, y, z);
colour.add(id);
if ((colour.r + colour.g + colour.b) % 42 == 0) {
row[z] = colour;
}
}
}
}
}
public static class Colour {
double r, g, b;
Colour(double r, double g, double b) {
this.r = r;
this.g = g;
this.b = b;
}
public void add(Colour other) {
r += other.r;
g += other.g;
b += other.b;
}
}
}