//NOME: Plinio A. S. Freire ra082505 // ============================================================================================ #include "eixos.inc" #declare NQ = 6; //numero de quadros-chaves #declare pernaD = array[NQ]; #declare pernaD[0] = 10; #declare pernaD[1] = 10; #declare pernaD[2] = 10; #declare pernaD[3] = 90; #declare pernaD[4] = 90; #declare pernaD[5] = 10; #declare pernaE = array[NQ]; #declare pernaE[0] = 10; #declare pernaE[1] = 90; #declare pernaE[2] = 45; #declare pernaE[3] = 90; #declare pernaE[4] = 10; #declare pernaE[5] = 10; #declare joelhoE = array[NQ]; #declare joelhoE[0] = 0; #declare joelhoE[1] = 0; #declare joelhoE[2] = 90; #declare joelhoE[3] = 0; #declare joelhoE[4] = 0; #declare joelhoE[5] = 0; #declare bracoD = array[NQ]; #declare bracoD[0] = 45; #declare bracoD[1] = 120; #declare bracoD[2] = 45; #declare bracoD[3] = 120; #declare bracoD[4] = 45; #declare bracoD[5] = 45; #declare bracoE = array[NQ]; #declare bracoE[0] = 45; #declare bracoE[1] = 45; #declare bracoE[2] = 120; #declare bracoE[3] = 120; #declare bracoE[4] = 120; #declare bracoE[5] = 45; #declare fq = array[NQ]; #declare fq[0] = 0.0; #declare fq[1] = 0.2; #declare fq[2] = 0.4; #declare fq[3] = 0.6; #declare fq[4] = 0.8; #declare fq[5] = 1.0; //camera e luz #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 20.0; #declare dir_camera = < 20,0, 4.50 >; #declare dist_camera = 16.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz) // cores e texturas background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare tx_red = texture{ pigment{ color rgb <1, 0, 0 >} finish{ diffuse 0.9 ambient 0.1 } } #declare tx_green = texture{ pigment{ color rgb <0, 1, 0>} finish{ diffuse 0.9 ambient 0.1 } } #declare tx_blue = texture{ pigment{ color rgb <0, 0, 1>} finish{ diffuse 0.9 ambient 0.1 } } #declare tx_marrom = texture{ pigment{ color rgb <0.8,0.6,0.3>} } //macro ////////////////////////////////////////////////////////////// #macro coelho(per1,antep1,pe1,per2,antep2,pe2,b1,anb1,b2,anb2) union{ sphere{<0,0,7> 1.2 texture{tx_marrom}} cylinder{ <0,0,7>, <0,-1,9>, 0.2 texture{tx_marrom}} cylinder{ <0,0,7>, <0,1,9>, 0.2 texture{tx_marrom}} sphere{<0,0,6>, 1 texture{tx_marrom}} cylinder{ <0,0,3>, <0,0,6>, 1 texture{tx_marrom}} sphere{<0,0,4>, 1 texture{tx_marrom}} object{braco(anb1) rotate -b1*x translate <0,0,5>} object{braco(anb2) rotate -b2*x translate <0,0,5> scale <1,-1,1>} object{perna(antep1,pe1) rotate -per1*x translate <0,0,3> scale <1,-1,1>} object{perna(antep2,pe2) rotate -per2*x translate <0,0,3>} } #end #macro perna(a,b) union { cone{<0,0,-4>, 0.4 <0,0,0>, 1 texture{tx_marrom}} object{anteperna(b) rotate a*y translate <0,0,-4> } } #end #macro anteperna(b) union { cone{<0,0,-2>, 0.4 <0,0,0>, 1.2 } object{pe() rotate b*y translate <0,0,-2>} } #end #macro pe() union { cone{<2,0,0>, 0 <0,0,0>, 0.3 } } #end #macro braco(a) union{ sphere{<0,0,0>, 0.5 texture{tx_marrom}} cylinder{<0,0,0>, <0,0,-1.6>, 0.3 texture{tx_marrom}} object{antebraco() rotate a*y translate <0,0,-1.6>} } #end #macro antebraco() union{ cone{ <0,0,0>, 0.3 <0,0,-2>, 0.1 texture{tx_marrom}} sphere{<0,0,-2>, 0.1 texture{tx_marrom}} } #end ////////////////////////////////////////////////////////////// #macro interpola(f0,v0,f1,v1,f) #local ss = (f-f0)/(f1-f0); #local rr = 1 - ss; (rr*v0 + ss*v1); #end #macro quadro_anterior(fase) #local i=0; #while(i= fase)) #local resp = i; #end; #local i=i+1; #end resp #end /*#macro coelho_dancante(fase) #local anterior = 0.0; #local pD = 0; #local pE = 0; #local jE = 0; #local bD = 0; #local bE = 0; anterior = object{quadro_anterior(fase)} pD = object{interpola(fq[anterior],pernaD[anterior],fq[anterior+1],pernaD[anterior+1],fase)} pE = object{interpola(fq[anterior],pernaE[anterior],fq[anterior+1],pernaE[anterior+1],fase)} jE = object{interpola(fq[anterior],joelhoE[anterior],fq[anterior+1],joelhoE[anterior+1],fase)} bD = object{interpola(fq[anterior],bracoD[anterior],fq[anterior+1],bracoD[anterior+1],fase)} bE = object{interpola(fq[anterior],bracoE[anterior],fq[anterior+1],bracoE[anterior+1],fase)} object{coelho(pD,0,0,pE,0,0,bD,0,bE,0) } #end*/ // ============================================================================================ union{ // object{ eixos(3.00) } // object{coelho(10,0,0,10,0,0,45,0,45,0) } // object{coelho(10,0,0,90,0,0,45,0,120,0) } // object{coelho(10,0,0,45,90,0,120,0,45,0) } // object{coelho(90,0,0,90,0,0,120,0,120,0) } // object{coelho(90,0,0,10,0,0,120,0,45,0) } // object{coelho(10,0,0,10,0,0,45,0,45,0) } }