// Homework 3 // Amelia (Amy) Nichols // Section D // aenichols@cmu.edu // Set screen size and init variables width and height: size( 800, 800, P3D ); // declare and initialize any variables you need here int x = 0; int y = 0; int z = 0; int depth = 0; int radius = (int)(.05*width); int edge = (int)(.08*width); // make your method calls println("Printing the initial: A"); // The follow sets up the graphics window; lights( ); directionalLight(155, 155, 155, 15, 20, -1); directionalLight(155, 155, 155, 85, 20, -1); noStroke( ); background( #04075A ); //camera(width*.90, height*.40, (height/2.0) / tan(PI*60.0 / 360.0), width/2.0, height/2.0, 0, 0, 1, 0); // red top spheres pushMatrix( ); translate( x+(width/2), y+(height/6), z+(depth) ); fill( #AF1747 ); sphere( radius ); popMatrix( ); pushMatrix( ); translate( x+(width/2), y+(height/6), z+(depth + 60) ); fill( #AF1747 ); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width/2), y+(height/6), z+(depth - 60) ); fill( #AF1747 ); sphere( radius/2 ); popMatrix( ); // green boxes pushMatrix( ); translate( x+(width*.40), y+(height/3), z+(depth) ); fill( #71F500 ); rotateZ(radians(115)); box( edge*2, edge/3, edge ); popMatrix( ); pushMatrix( ); translate( x+(width*.60), y+(height/3), z+(depth) ); fill( #71F500 ); rotateZ(radians(-115)); box( edge*2, edge/3, edge); popMatrix( ); pushMatrix( ); translate( x+(width*.50), y+(height*.50), z+(depth) ); fill( #71F500 ); rotateY(radians(45)); rotateZ(radians(45)); box(edge/2); popMatrix( ); pushMatrix( ); translate( x+(width*.40), y+(height*.50), z+(depth) ); fill( #71F500 ); rotateY(radians(45)); rotateZ(radians(45)); box(edge/2); popMatrix( ); pushMatrix( ); translate( x+(width*.60), y+(height*.50), z+(depth) ); fill( #71F500 ); rotateY(radians(45)); rotateZ(radians(45)); box(edge/2); popMatrix( ); pushMatrix( ); translate( x+(width*.27), y+(height*.63), z+(depth) ); fill( #71F500 ); rotateZ(radians(115)); box( edge*2, edge/3, edge); popMatrix( ); pushMatrix( ); translate( y+(width*.74), y+(height*.63), z+(depth) ); fill( #71F500 ); rotateZ(radians(-115)); box( edge*2, edge/3, edge); popMatrix( ); // orange middle spheres pushMatrix( ); translate( x+(width*.68), y+(height/2), z+(depth) ); fill( #F55A00 ); sphere( radius ); popMatrix( ); pushMatrix( ); translate( x+(width*.68), y+(height/2), z+(depth - 60) ); fill( #F55A00 ); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width*.68), y+(height/2), z+(depth + 60) ); fill( #F55A00 ); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width*.32), y+(height/2), z+(depth) ); fill( #F55A00 ); sphere( radius ); popMatrix( ); pushMatrix( ); translate( x+(width*.32), y+(height/2), z+(depth + 60) ); fill( #F55A00 ); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width*.32), y+(height/2), z+(depth - 60) ); fill( #F55A00 ); sphere( radius/2 ); popMatrix( ); // yellow spheres - bottom pushMatrix( ); translate( x+(width*.18), y+(height*.75), z+(depth) ); fill( #F5A400 ); sphere( radius ); popMatrix( ); pushMatrix( ); translate( x+(width*.18), y+(height*.75), z+(depth + 60) ); fill( #F5A400 ); rotateZ(radians(45)); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width*.18), y+(height*.75), z+(depth - 60) ); fill( #F5A400 ); rotateZ(radians(45)); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width*.82), y+(height*.75), z+(depth) ); fill( #F5A400 ); sphere( radius ); popMatrix( ); pushMatrix( ); translate( x+(width*.82), y+(height*.75), z+(depth + 60) ); fill( #F5A400 ); rotateZ(radians(45)); sphere( radius/2 ); popMatrix( ); pushMatrix( ); translate( x+(width*.82), y+(height*.75), z+(depth - 60) ); fill( #F5A400 ); rotateZ(radians(45)); sphere( radius/2 ); popMatrix( ); // A middle line pushMatrix( ); translate( x+(width*.50), y+(height*.50), z+(depth) ); fill( #94F0ED, 95 ); box(edge*4, edge/10, edge*5); popMatrix( ); // Top/bottom platforms pushMatrix( ); translate( x+(width*.76), y+(height*.75), z+(depth) ); fill( #94F0ED, 95 ); box( edge*3, edge/10, edge*5 ); popMatrix( ); pushMatrix( ); translate( x+(width*.24), y+(height*.75), z+(depth) ); fill( #94F0ED, 95 ); box( edge*3, edge/10, edge*5 ); popMatrix( ); pushMatrix( ); translate( x+(width/2), y+(height/7), z+(depth) ); fill( #94F0ED, 95 ); box( edge*2, edge/10, edge*5); popMatrix( ); // Side platforms pushMatrix( ); translate( x+(width*.35), y+(height*.45), z+(depth) ); fill( #94F0ED, 95 ); rotateZ(radians(115)); box( edge*8, edge/10, edge*5 ); popMatrix( ); pushMatrix( ); translate( x+(width*.65), y+(height*.45), z+(depth) ); fill( #94F0ED, 95 ); rotateZ(radians(-115)); box( edge*8, edge/10, edge*5 ); popMatrix( );