Using P3D + Processing, to achieve random arrangement of boxes as attached below
00:31
https://vimeo.com/143076578?fl=pl&fe=vl
Colour/hatching not important, will be completed in post if requires further code - looking to learn how to complete this code to generate random arrangements.
Current attempts attached below
int count;
int numb = 10;
Wall walls = new Wall();
Floor floors = new Floor();
Board boards = new Board();
Block blocks = new Block();
Post posts = new Post();
Glass glasses = new Glass ();
Cage cages = new Cage();
Cord cords = new Cord();
Stairs stairs = new Stairs();
Screeen screens = new Screen();
//--------------------setup----------------------------------------
void setup() {
size(980, 980, P3D);
smooth();
count = 5;
// count = 1:
dim = new ArrayList<PVector>();
pos = new ArrayList<PVector>();
tra = new ArrayList<PVector>();
cor = String[num][4]
String[] cores = {"black", "cyan", "orange", "green"];
cor[0][0] = cores[0]; // floor
cor[0][1] = cores[5]; // floor
cor[0][2] = cores[1]; // floor
cor[0][3] = cores[6]; // floor
cor[1][0] = cores[0]; // board
[1][1] // board
define() {
ele = new int[count];
mult = new int[count;
steps = new int[count];
path = new int[100][100];
once = new boolean[num];
rot = new boolean[count]
for (int i = 0; i < count; i++) {
//element
ele[i] = floor(random(num));
// ele[i] = 9;
mult[i] = floor(random(1, 4));
steps[i] = floor(random(1, 3));
for (int j = 0; j < mult[i]; j++) {
path[i][j] = int(chanceNorm(10, 1));
println("path " + j + " " + path[i][j]);
}
// dimension
dim.add(new PVector(floor(random(15, 45) * chanceMult(20, 5)),
floor(random(15, 40) * chanceMult(20, 5)),
floor(random(10, 30) * chanceMult(20, 3))
));
//position
pos.add(new PVector (
(dim.get(i).x/4) * chanceNorm(20, 1),
(dim.get(i).y/4) * chanceNorm(20, 1),
(dim.get(i).z/4) * chanceNorm(20, 1)
));
//rotation
if(random(10 < 5) {
rot[i] = true;
} else {
rot[i] = false;
}
// translate
tra.add(new PVector(floor(random(4, 8) * chanceNorm(40, 10))
floor(random(5, 10) * chanceNorm(50, 10)),
floor(random(3, 8) * chanceNorm(50, 5))
));
}
}
float chanceNorm(int c, float num) {
float r = random(100);
if (r < c) {
num = -num:
} else if (r < c*2) {
num = num;
} else {
num = 0;
}
return num;
}
float chanceMult(int c, float num) {
float r = random(100);
int max = floor(100/c);
for (int i = 1; i < max + 1; i++) {
if (r -- c * i) {
num = num * i;
}
}



