// Exercicio 7 da 8a. aula de Laboratorio - MC930 - Prof. Stolfi // Eduardo C. Lazarine - RA 970561 #include "colors.inc" #include "stones.inc" #include "woods.inc" background{ color rgb < 0, 0.75, 1> } plane{<0,0,1> 0 color rgb <1,1,1>} light_source { < 100,100, 100 > color rgb < 1.00, 1.00, 1.00 > } camera { location < 50, 50, 50 > right < 2.40, 0.00, 0.00 > up < 0.00, 0.00, 1.80 > sky < 0.00, 0.00, 1.00 > look_at < 0.00,- 0.00, -0.00 > } #declare i=1 #declare rt = seed(pi) #declare quarteirao = box{ <0,0,0> <10,10,0.8> texture {T_Stone3}} #declare bloco = union { box{<0,0,0> <2,2,2.5> pigment {color rgb < 1, 0.75, 0>}} box{<0.5,-0.1,1 > <1.5,2.1, 1.8> pigment{ color rgb <0,0.75,1>}} box{<-0.1, 0.7,1.2> <2.1, 1.3, 1.7> pigment{ color rgb <0,0.75,1>}} } #declare primandar = union { box{<0,0,0> <2,2,2.5> pigment {color rgb < 1, 0.75, 0>}} box{<0.5,-0.1,0 > <1.5,2.1, 1.8> pigment{ color rgb <0,0,0>}} box{<-0.1, 0.7,0> <2.1, 1.3, 1.8> pigment{ color rgb <0,0,0>}} } #declare h = 2; #declare andar = union{ #declare g = rand(rt) #if (g < 0.5) #declare aux = 1 object{bloco translate <0,0,h>} object{bloco translate <0,2,h>} object{bloco translate <2,0,h>} object{bloco translate <2,2,h>} #else #declare aux = 2 #declare j=1 object{bloco translate <0,0,h>} #while (j < 3) object{bloco translate <0,2*j,h> } object{bloco tranlate <2*j,0,h> } object{bloco translate <2*j,2*j,h> } #declare j = j + 1 #end #end } #declare base = #if (aux = 1) object{primandar} object{primandar translate <0,2,0>} object{primandar translate <2,0,0>} object{primandar translate <2,2,0>} #else #declare j=1 object{primandar} #while (j < 3) object{primandar translate <0,2*j,0> } object{primandar tranlate <2*j,0,0> } object{primandar translate <2*j,2*j,0> } #declare j = j + 1 #end #end #declare predio = union{ #declare l=1 #declare g = rand(rt) #while ( l < (30*g)) #declare h = 2*l #if (g < 0.5) #declare aux = 1 object{bloco translate <0,0,h>} object{bloco translate <0,2,h>} object{bloco translate <2,0,h>} object{bloco translate <2,2,h>} #else #declare aux = 2 #declare j=1 object{bloco translate <0,0,h>} #while (j < 3) object{bloco translate <0,2*j,h> } object{bloco translate <2*j,0,h> } object{bloco translate <2*j,2*j,h> } #declare j = j + 1 #end #end #declare l = l+1 #end #if (aux = 1) object{primandar} object{primandar translate <0,2,0>} object{primandar translate <2,0,0>} object{primandar translate <2,2,0>} #else #declare j=1 object{primandar} #while (j < 3) object{primandar translate <0,2*j,0> } object{primandar translate <2*j,0,0> } object{primandar translate <2*j,2*j,0> } #declare j = j + 1 #end #end } object {predio} object { union{ #declare l=1 #declare g = rand(rt) #while ( l < (30*g)) #declare h = 2*l #if (g < 0.5) #declare aux = 1 object{bloco translate <0,0,h>} object{bloco translate <0,2,h>} object{bloco translate <2,0,h>} object{bloco translate <2,2,h>} #else #declare aux = 2 #declare j=1 object{bloco translate <0,0,h>} #while (j < 3) object{bloco translate <0,2*j,h> } object{bloco translate <2*j,0,h> } object{bloco translate <2*j,2*j,h> } #declare j = j + 1 #end #end #declare l = l+1 #end #if (aux = 1) object{primandar} object{primandar translate <0,2,0>} object{primandar translate <2,0,0>} object{primandar translate <2,2,0>} #else #declare j=1 object{primandar} #while (j < 3) object{primandar translate <0,2*j,0> } object{primandar translate <2*j,0,0> } object{primandar translate <2*j,2*j,0> } #declare j = j + 1 #end #end } translate <20,20,0> } object { union{ #declare l=1 #declare g = rand(rt) #while ( l < (7*g)) #declare h = 2*l #if (g < 0.5) #declare aux = 1 object{bloco translate <0,0,h>} object{bloco translate <0,2,h>} object{bloco translate <2,0,h>} object{bloco translate <2,2,h>} #else #declare aux = 2 #declare j=1 object{bloco translate <0,0,h>} #while (j < 3) object{bloco translate <0,2*j,h> } object{bloco translate <2*j,0,h> } object{bloco translate <2*j,2*j,h> } #declare j = j + 1 #end #end #declare l = l+1 #end #if (aux = 1) object{primandar} object{primandar translate <0,2,0>} object{primandar translate <2,0,0>} object{primandar translate <2,2,0>} #else #declare j=1 object{primandar} #while (j < 3) object{primandar translate <0,2*j,0> } object{primandar translate <2*j,0,0> } object{primandar translate <2*j,2*j,0> } #declare j = j + 1 #end #end } translate <10, 10,0> } object {quarteirao} object {quarteirao translate <15,15,0>} object {quarteirao translate <0,15,0>} object {quarteirao translate <15,0,0>} object {quarteirao translate <30,30,0>} object {quarteirao translate <30,0,0>} object {quarteirao translate <0,30,0>}