// Desenho do robô garçom // Last edited on 2020-11-11 21:53:00 by Guilherme Londe // ====================================================================== // 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_interpola(tt, i, f) #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 #macro quadro(tf) #local P0 = array[23] { 0,0,0,-30,-30,-30,-30, 90,0,-180,-200,0,-25,-20, 30, 80, 30,90,0,-90, 160,0,-25} #local P1 = array[23] { 360,0,0, 90, 90, 90, 90,-45,0, 180,-110,0,-25, 30, 80, 30,-20,45,0, 90, 70,0,-25} #local P2 = array[23] { 720,0,0,-30,-30,-30,-30, 90,0,-180, -20,0,-25, 80, 30,-20, 30, 0,0,-90, -20,0,-25} #local P3 = array[23] {1080,0,0, 90, 90, 90, 90,-45,0, 180, 70,0,-25, 30,-20, 30, 80,45,0, 90,-110,0,-25} #local P4 = array[23] {1440,0,0,-30,-30,-30,-30, 90,0,-180, 160,0,-25,-20, 30, 80, 30,90,0,-90,-200,0,-25} #local T0 = 0; #local T1 = 0.25; #local T2 = 0.5; #local T3 = 0.75; #local T4 = 1; #if (T0 <= tf & tf <= T1) #local tt = (tf - T0)/(T1 - T0); #local qd = robo_interpola(tt, P0, P1); #elseif (T1 <= tf & tf <= T2) #local tt = (tf - T1)/(T2 - T1); #local qd = robo_interpola(tt, P1, P2); #elseif (T2 <= tf & tf <= T3) #local tt = (tf - T2)/(T3 - T2); #local qd = robo_interpola(tt, P2, P3); #elseif (T3 <= tf & tf <= T4) #local tt = (tf - T3)/(T4 - T3); #local qd = robo_interpola(tt, P3, P4); #end qd #end #include "eixos.inc" // Aqui esta a cena, finalmente: union{ object{quadro(clock) } } #include "camlight.inc" #declare raio_cena = 25.0; #declare centro_cena = < 0.00, 0.00, 5.00 >; #declare dir_camera = < 1.00, 3.00, 0.50 >; #declare dist_camera = 15*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)