/* 15-100 D Homework #3 Dae Hong Kim daek@andrew.cmu.edu */ size( 600, 600, P3D ); float boxSize = 600/20; // 3D box size float boxSpace = boxSize*1.2; // space between boxes println("my initial is H"); //rotateY(PI/3); lights( ); noStroke( ); background(200); //draw initial H pushMatrix(); for(float z = -boxSpace; z <= boxSpace; z += boxSpace){ pushMatrix( ); translate(width/2, height/2, z); fill(random(255), random(255), random(255)); box(boxSize); for(int count=0; count < 4; count++){ translate(boxSpace, 0, 0); fill(random(255), random(255), random(255)); box(boxSize); } pushMatrix(); for(int count=0; count < 4; count++){ translate(0, -boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); for(int count=0; count < 4; count++){ translate(0, boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); pushMatrix(); translate(width/2, height/2,z); for(int count=0; count <4; count++){ translate(-boxSpace, 0, 0); fill(random(255), random(255), random(255)); box(boxSize); } pushMatrix(); for(int count=0; count <4; count++){ translate(0, -boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); for(int count=0; count <4; count++){ translate(0, boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); // back to the original coordinate pushMatrix( ); // save th original coordinate translate(width/2, height/2 - boxSpace, z); fill(random(255), random(255), random(255)); box(boxSize); for(int count=0; count < 3; count++){ translate(boxSpace, 0, 0); fill(random(255), random(255), random(255)); box(boxSize); } for(int count=0; count < 3; count++){ translate(0, -boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); pushMatrix( ); // save th original coordinate translate(width/2, height/2 + boxSpace, z); fill(random(255), random(255), random(255)); box(boxSize); for(int count=0; count < 3; count++){ translate(boxSpace, 0, 0); fill(random(255), random(255), random(255)); box(boxSize); } for(int count=0; count < 3; count++){ translate(0, boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); pushMatrix( ); // save th original coordinate translate(width/2, height/2 - boxSpace, z); fill(random(255), random(255), random(255)); box(boxSize); for(int count=0; count < 3; count++){ translate(-boxSpace, 0, 0); fill(random(255), random(255), random(255)); box(boxSize); } for(int count=0; count < 3; count++){ translate(0, -boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); pushMatrix( ); // save th original coordinate translate(width/2, height/2 + boxSpace, z); fill(random(255), random(255), random(255)); box(boxSize); for(int count=0; count < 3; count++){ translate(-boxSpace, 0, 0); fill(random(255), random(255), random(255)); box(boxSize); } for(int count=0; count < 3; count++){ translate(0, boxSpace, 0); fill(random(255), random(255), random(255)); box(boxSize); } popMatrix(); } popMatrix();