// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2017-05-07 20:10:09 by stolfilocal // ====================================================================== // 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 tk = array[6]; #declare tk[0] = 0; #declare tk[1] = 0.2; #declare tk[2] = 0.4; #declare tk[3] = 0.6; #declare tk[4] = 0.8; #declare tk[5] = 1; #macro interpolaLin (t0, v0, t1, v1, tt) #local r = (tt-t0)/(t1-t0); #local s = 1-r; #local vv = s*v0 + r*v1; vv #end #macro interpolaMatriz (Q,k0,k1,NP,NA,t0,t1,tt,A) #local ii = 0; #while (ii < NP) #local kk = 0; #while (kk < NA) #declare A[ii][kk] = interpolaLin(t0,Q[k0][ii][kk],t1,Q[k1][ii][kk],tt); #local kk = kk + 1; #end #local ii = ii + 1; #end #end #macro buscaTempo (clk,NQ,tk) #local k = 0; #local resultado = 0; #while (k < NQ-1) #if(clk >= tk[k] & clk < tk[k+1]) #local resultado = k; #end #local k = k+1; #end resultado #end #declare p5 = union { object{sphere{<0,0,0>, 20 texture{tx_plastico}}} object{cylinder{<10,0,0>, <100,0,0>, 20 texture{tx_fosca}}} } #macro art4 (et) #declare p4 = union { object{sphere{<0,0,0>, 20 texture{tx_plastico}}} object{cylinder{<10,0,0>, <100,0,0>, 20 texture{tx_fosca}}} object{p5 rotate <0,et,0> translate <100,0,0>} } #end #macro art3 (dt, et) #declare p3 = union { object{sphere{<0,0,0>, 20 texture{tx_plastico}}} object{cylinder{<10,0,0>, <100,0,0>, 20 texture{tx_fosca}}} art4(et) object{p4 rotate <0,dt,0> translate <100,0,0>} } #end #macro art2 (ct,dt,et) #declare p2 = union { object{sphere{<0,0,0>, 20 texture{tx_plastico}}} object{cylinder{<10,0,0>, <100,0,0>, 20 texture{tx_fosca}}} art3(dt,et) object{p3 rotate <0,ct,0> translate <100,0,0>} } #end #macro art1 (bt,ct,dt,et) #declare p1 = union { object{sphere{<0,0,0>, 20 texture{tx_plastico}}} object{cylinder{<10,0,0>, <100,0,0>, 20 texture{tx_fosca}}} art2(ct,dt,et) object{p2 rotate <0,bt,0> translate <100,0,0>} } #end //NQ = numero de quadros //NP = numero de pernas //NA = numero de graus de liberdade //KC = quadro atual #declare NQ = 6; #declare NP = 6; #declare NA = 5; #declare KC = buscaTempo(clock,NQ,tk); #declare Q = array[NQ][NP][NA]; #declare A = array[NP][NA]; //Q0 #declare Q[0][0][0] = 30; #declare Q[0][1][0] = 30; #declare Q[0][2][0] = 30; #declare Q[0][3][0] = 30; #declare Q[0][4][0] = 30; #declare Q[0][5][0] = 30; #declare Q[0][0][1] = 45; #declare Q[0][1][1] = 45; #declare Q[0][2][1] = 45; #declare Q[0][3][1] = 45; #declare Q[0][4][1] = 45; #declare Q[0][5][1] = 45; #declare Q[0][0][2] = 50; #declare Q[0][1][2] = 50; #declare Q[0][2][2] = 50; #declare Q[0][3][2] = 50; #declare Q[0][4][2] = 50; #declare Q[0][5][2] = 50; #declare Q[0][0][3] = 15; #declare Q[0][1][3] = 30; #declare Q[0][2][3] = 40; #declare Q[0][3][3] = 45; #declare Q[0][4][3] = 50; #declare Q[0][5][3] = 50; #declare Q[0][0][4] = 45; #declare Q[0][1][4] = 45; #declare Q[0][2][4] = 45; #declare Q[0][3][4] = 45; #declare Q[0][4][4] = 45; #declare Q[0][5][4] = 45; //Q1 #declare Q[1][0][0] = 45; #declare Q[1][1][0] = 55; #declare Q[1][2][0] = 65; #declare Q[1][3][0] = 35; #declare Q[1][4][0] = 25; #declare Q[1][5][0] = 60; #declare Q[1][0][1] = 25; #declare Q[1][1][1] = 30; #declare Q[1][2][1] = 40; #declare Q[1][3][1] = 50; #declare Q[1][4][1] = 34; #declare Q[1][5][1] = 23; #declare Q[1][0][2] = 25; #declare Q[1][1][2] = 34; #declare Q[1][2][2] = 58; #declare Q[1][3][2] = 34; #declare Q[1][4][2] = 58; #declare Q[1][5][2] = 34; #declare Q[1][0][3] = 45; #declare Q[1][1][3] = 32; #declare Q[1][2][3] = 45; #declare Q[1][3][3] = 71; #declare Q[1][4][3] = 25; #declare Q[1][5][3] = 35; #declare Q[1][0][4] = 24; #declare Q[1][1][4] = 32; #declare Q[1][2][4] = 36; #declare Q[1][3][4] = 12; #declare Q[1][4][4] = 18; #declare Q[1][5][4] = 22; //Q2 #declare Q[2][0][0] = 12; #declare Q[2][1][0] = 25; #declare Q[2][2][0] = 35; #declare Q[2][3][0] = 12; #declare Q[2][4][0] = 25; #declare Q[2][5][0] = 38; #declare Q[2][0][1] = 15; #declare Q[2][1][1] = 18; #declare Q[2][2][1] = 12; #declare Q[2][3][1] = 13; #declare Q[2][4][1] = 15; #declare Q[2][5][1] = 35; #declare Q[2][0][2] = 13; #declare Q[2][1][2] = 15; #declare Q[2][2][2] = 15; #declare Q[2][3][2] = 14; #declare Q[2][4][2] = 16; #declare Q[2][5][2] = 18; #declare Q[2][0][3] = 14; #declare Q[2][1][3] = 13; #declare Q[2][2][3] = 15; #declare Q[2][3][3] = 45; #declare Q[2][4][3] = 13; #declare Q[2][5][3] = 15; #declare Q[2][0][4] = 13; #declare Q[2][1][4] = 15; #declare Q[2][2][4] = 45; #declare Q[2][3][4] = 32; #declare Q[2][4][4] = 28; #declare Q[2][5][4] = 15; //Q3 #declare Q[3][0][0] = 35; #declare Q[3][1][0] = 60; #declare Q[3][2][0] = 32; #declare Q[3][3][0] = 32; #declare Q[3][4][0] = 32; #declare Q[3][5][0] = 32; #declare Q[3][0][1] = 12; #declare Q[3][1][1] = 15; #declare Q[3][2][1] = 40; #declare Q[3][3][1] = 45; #declare Q[3][4][1] = 45; #declare Q[3][5][1] = 50; #declare Q[3][0][2] = 31; #declare Q[3][1][2] = 35; #declare Q[3][2][2] = 23; #declare Q[3][3][2] = 18; #declare Q[3][4][2] = 25; #declare Q[3][5][2] = 38; #declare Q[3][0][3] = 21; #declare Q[3][1][3] = 13; #declare Q[3][2][3] = 25; #declare Q[3][3][3] = 25; #declare Q[3][4][3] = 25; #declare Q[3][5][3] = 25; #declare Q[3][0][4] = 18; #declare Q[3][1][4] = 18; #declare Q[3][2][4] = 18; #declare Q[3][3][4] = 18; #declare Q[3][4][4] = 18; #declare Q[3][5][4] = 18; //Q4 #declare Q[4][0][0] = 35; #declare Q[4][1][0] = 35; #declare Q[4][2][0] = 35; #declare Q[4][3][0] = 35; #declare Q[4][4][0] = 35; #declare Q[4][5][0] = 35; #declare Q[4][0][1] = 48; #declare Q[4][1][1] = 48; #declare Q[4][2][1] = 48; #declare Q[4][3][1] = 48; #declare Q[4][4][1] = 48; #declare Q[4][5][1] = 48; #declare Q[4][0][2] = 12; #declare Q[4][1][2] = 12; #declare Q[4][2][2] = 12; #declare Q[4][3][2] = 12; #declare Q[4][4][2] = 12; #declare Q[4][5][2] = 12; #declare Q[4][0][3] = 25; #declare Q[4][1][3] = 25; #declare Q[4][2][3] = 25; #declare Q[4][3][3] = 25; #declare Q[4][4][3] = 25; #declare Q[4][5][3] = 25; #declare Q[4][0][4] = 25; #declare Q[4][1][4] = 25; #declare Q[4][2][4] = 25; #declare Q[4][3][4] = 25; #declare Q[4][4][4] = 25; #declare Q[4][5][4] = 25; //Q5 #declare Q[5][0][0] = 30; #declare Q[5][1][0] = 30; #declare Q[5][2][0] = 30; #declare Q[5][3][0] = 30; #declare Q[5][4][0] = 30; #declare Q[5][5][0] = 30; #declare Q[5][0][1] = 45; #declare Q[5][1][1] = 45; #declare Q[5][2][1] = 45; #declare Q[5][3][1] = 45; #declare Q[5][4][1] = 45; #declare Q[5][5][1] = 45; #declare Q[5][0][2] = 50; #declare Q[5][1][2] = 50; #declare Q[5][2][2] = 50; #declare Q[5][3][2] = 50; #declare Q[5][4][2] = 50; #declare Q[5][5][2] = 50; #declare Q[5][0][3] = 15; #declare Q[5][1][3] = 30; #declare Q[5][2][3] = 40; #declare Q[5][3][3] = 45; #declare Q[5][4][3] = 50; #declare Q[5][5][3] = 50; #declare Q[5][0][4] = 45; #declare Q[5][1][4] = 45; #declare Q[5][2][4] = 45; #declare Q[5][3][4] = 45; #declare Q[5][4][4] = 45; #declare Q[5][5][4] = 45; //Q = matriz //KC = quadro chave #macro dragao (A) object{cylinder{<-300,0,0>, <300,0,0>, 100 texture{tx_fosca}}} object{cone{<300,0,0>, 100, <450,0,0>, 0 texture{tx_fosca}}} art1 (A[0][1],A[0][2],A[0][3],A[0][4]) object{p1 rotate <0,A[0][0],90> translate <-200,110,0>} art1 (A[1][1],A[1][2],A[1][3],A[1][4]) object{p1 rotate <0,A[1][0],90> translate <0,110,0>} art1 (A[2][1],A[2][2],A[2][3],A[2][4]) object{p1 rotate <0,A[2][0],90> translate <200.110,0>} art1 (A[3][1],A[3][2],A[3][3],A[3][4]) object{p1 scale <-1,1,1> rotate <0,A[3][0],90> translate <-200,-110,0>} art1 (A[4][1],A[4][2],A[4][3],A[4][4]) object{p1 scale <-1,1,1> rotate <0,A[4][0],90> translate <0,-110,0>} art1 (A[5][1],A[5][2],A[5][3],A[5][4]) object{p1 scale <-1,1,1> rotate <0,A[5][0],90> translate <200,-110,0>} #end #macro interpola_quadros (Q,NP,NA,KC,tt,A) interpolaMatriz(Q,KC,KC+1,NP,NA,tk[KC],tk[KC+1],tt,A) dragao(A) #end interpola_quadros(Q,NP,NA,KC,clock,A) #include "eixos.inc" #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 850; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)