// Desenho do robô garçom // Last edited on 2020-12-08 11:07:44 by jstolfi #version 3.6; // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.80, 0.80, 0.80 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.30, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } // ====================================================================== // DESCRICAO // Partes da cena: #macro cabeca(hz) union{ cylinder{<0,0,0>,<0,0,3.0>,3.0 texture{ tx_plastico }} object{ cylinder{<-1,0,2>,<-1,4,2>,0.5 texture{ tx_plastico }} rotate<0,0,hz>} object{ cylinder{<1,0,2>,<1,4,2>,0.5 texture{ tx_plastico }} rotate<0,0,hz>} } #end #macro pescoco(hz, frente, lado) union{ sphere{<0,0,0>, 1.0 texture{ tx_plastico }} object{ cylinder{<0,0,0>, <0,0,3>, 0.6 texture{ tx_plastico }} rotate} object{ cabeca(hz) translate<0,0,3> rotate} } #end #macro dedo(frente) union{ object{ cylinder{<0,0,0>, <0,0,3.0>, 0.2 texture{ tx_plastico }} rotate<0,frente,0> } } #end #macro mao(dedoa_f, dedob_f, dedoc_f, dedod_f, dedoe_f) union{ object{ cylinder{<0,-0.8,0>, <0,0.8,0>, 1 texture{ tx_plastico }}} object{ dedo(dedoa_f) translate<0,-0.7,1> } object{ dedo(dedob_f) translate<0,-0.2,1> } object{ dedo(dedoc_f) translate<0,0.2,1> } object{ dedo(dedod_f) translate<0,0.7,1> } object{ dedo(dedoe_f) rotate<90,0,90> translate<0,0.8,0>} } #end #macro antebraco(daf, dbf, dcf, ddf, def, giro) union{ sphere{<0,0,0>, 0.7 texture{ tx_plastico }} cylinder{<0,0,0>, <0,0,5>, 0.3 texture{tx_plastico}} object{ mao(daf, dbf, dcf, ddf, def) rotate<0,0,giro> translate<0,0,5>} } #end #macro braco(daf, dbf, dcf, ddf, def, gr, frente) union{ sphere{<0,0,0>, 0.7 texture{tx_plastico}} cylinder{<0,0,0>, <0,0,5>, 0.3 texture{tx_plastico}} object{antebraco(daf, dbf, dcf, ddf, def, gr) rotate translate<0,0,5>} } #end #macro robo(phz, pf, pl, daf1, dbf1, dcf1, ddf1, def1, gr1, abf1, braco_verti1, braco_giro1, braco_hori1, daf2, dbf2, dcf2, ddf2, def2, gr2, abf2, braco_verti2, braco_giro2, braco_hori2) union{ cylinder{<0,0,0>, <0,0,10>, 4 texture{ tx_plastico }} object{ pescoco(phz, pf, pl) translate<0,0,10> } object{ braco(daf1, dbf1, dcf1, ddf1, def1, gr1, abf1) rotate<0,0,braco_giro1> rotate<0,braco_hori1,0> rotate translate<-4,0,9> } object{ braco(daf2, dbf2, dcf2, ddf2, def2, gr2, abf2) rotate<0,0,braco_giro2> rotate<0,braco_hori2,0> rotate scale<-1,1,1> translate<4,0,9> } } #end #macro interpola(tt, tt0, tt1, vv0, vv1) #local rr = (tt - tt0)/(tt1 - tt0); #local vv = (1-rr)*vv0 + rr*vv1; vv #end #macro robo_vet(p) object{ robo(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22])} #end #macro robo_mov(tt) #local i = array[23]{0,0,0,0,0,0,0,0,0,0,-200,0,-25,0,0,0,0,0,0,0,-200,0,-25} #local f = array[23]{0,5,0,30,30,30,30,30,10,40,-50,0,-35,30,30,30,30,30,10,40,-50,0,-35} #local p = array[23]; #local j = 0; #while(j < 23) #local p[j] = interpola(tt,0,1,i[j],f[j]); #local j = j+1; #end object{ robo_vet(p)} #end #include "eixos.inc" // Aqui esta a cena, finalmente: union{ #local kk = 0; #local nn = 12; #while (kk < nn) #local tt = kk/nn; #local ang = (0.8*tt + 0.6)*pi; object {robo_mov(tt) rotate -90*z translate 60 * < cos(ang), sin(ang), 0 > } #local kk = kk+1; #end } #include "camlight.inc" #declare centro_cena = < -30.00, 0.00, 5.00 >; #declare raio_cena = 65.0; #declare dir_camera = < 4.00, 1.00, 3.00 >; #declare dist_camera = 15*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)