// 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_peca = texture{ pigment{ color rgb < 0.5, 0.5, 0.5 > } 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.0, 0.0, 0.0 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 1.0 } // ====================================================================== // DESCRIÇÃO DA CENA #include "eixos.inc" #declare raio = 1; #declare altura = 4; #declare tx = tx_peca #declare artic = sphere {<0,0,0>, raio texture {tx}} #declare seg = cylinder {<0,0,raio/2>, <0,0,altura>, raio texture {tx}} #macro perna() #union{ object {artic} object {seg} } #end #macro perna2(ang) #union{ object { perna() } object { perna() rotate translate <0, 0, altura> } } #end #macro perna3(ang1, ang2) #union{ object { perna() } object { perna2(ang1) rotate translate <0, 0, altura> } } #end #macro perna4(ang1, ang2, ang3) #union{ object { perna() } object { perna3(ang1, ang2) rotate translate <0, 0, altura> } } #end #macro perna5(ang1, ang2, ang3, ang4) #union{ object { perna() } object { perna4(ang1, ang2, ang3) rotate translate <0, 0, altura> } } #end #macro perna6(ang1, ang2, ang3, ang4, ang5) #union{ object { perna() } object { perna5(ang1, ang2, ang3, ang4) rotate translate <0, 0, altura> } } #end //perna6(45, -45, 45, -45, 45) #macro inseto(A) #union{ object { box { <-20,-10,-5>, <20, 10, 5> texture {tx}} } object { perna6(A[0][0], A[0][1], A[0][2], A[0][3], A[0][4]) translate <0,10,5> rotate <150,0,0>} object { perna6(A[1][0], A[1][1], A[1][2], A[1][3], A[1][4]) translate <-10,10,5> rotate <150,0,0>} object { perna6(A[2][0], A[2][1], A[2][2], A[2][3], A[2][4]) translate <10,10,5> rotate <150,0,0>} object { perna6(A[3][0], A[3][1], A[3][2], A[3][3], A[3][4]) translate <0,10,5> rotate <150,0,180>} object { perna6(A[4][0], A[4][1], A[4][2], A[4][3], A[4][4]) translate <-10,10,5> rotate <150,0,180>} object { perna6(A[5][0], A[5][1], A[5][2], A[5][3], A[5][4]) translate <10,10,5> rotate <150,0,180>} } #end #macro vetorK(n_chaves) #local tk = array[n_chaves]; #local i = 0; #while (i < n_chaves) #local tk[i] = i/(n_chaves-1); #local i = i + 1; #end tk #end #macro buscaTempo(clk, n_chaves, tk) #local i = 0; #while (tk[i] < clk) #local i = i + 1; #end #if (i = 0) #local r = i; #else #local r = i - 1; #end r #end #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 interpolaQuadros(Q, k0, k1, n_pernas, n_graus, c0, c1, cc, A) #local i = 0; #local j = 0; #while (i < n_pernas) #while (j < n_graus) #declare A[i][j] = interpolalin(c0, Q[k0][i][j], c1 , Q[k1][i][j], cc); #local j = j + 1; #end #local i = i + 1; #local j = 0; #end #end #macro cena(Q, k0, k1, A, n_pernas, n_graus, n_cenas, clk) interpolaQuadros(Q, k0, k1, n_pernas, n_graus, k0/(n_cenas-1), k1/(n_cenas-1), clk, A) inseto(A) #end #declare n_graus = 5; #declare n_pernas = 6; #declare n_chaves = 6; #declare Q = array[n_chaves][n_pernas][n_graus]; #declare Q[0][0][0] = 45; #declare Q[0][0][1] = -45; #declare Q[0][0][2] = 45; #declare Q[0][0][3] = -45; #declare Q[0][0][4] = 45; #declare Q[0][1][0] = 45; #declare Q[0][1][1] = -45; #declare Q[0][1][2] = 45; #declare Q[0][1][3] = -45; #declare Q[0][1][4] = 45; #declare Q[0][2][0] = 45; #declare Q[0][2][1] = -45; #declare Q[0][2][2] = 45; #declare Q[0][2][3] = -45; #declare Q[0][2][4] = 45; #declare Q[0][3][0] = 45; #declare Q[0][3][1] = -45; #declare Q[0][3][2] = 45; #declare Q[0][3][3] = -45; #declare Q[0][3][4] = 45; #declare Q[0][4][0] = 45; #declare Q[0][4][1] = -45; #declare Q[0][4][2] = 45; #declare Q[0][4][3] = -45; #declare Q[0][4][4] = 45; #declare Q[0][5][0] = 45; #declare Q[0][5][1] = -45; #declare Q[0][5][2] = 45; #declare Q[0][5][3] = -45; #declare Q[0][5][4] = 45; #declare Q[1][0][0] = -45; #declare Q[1][0][1] = 45; #declare Q[1][0][2] = -45; #declare Q[1][0][3] = -45; #declare Q[1][0][4] = -80; #declare Q[1][1][0] = 45; #declare Q[1][1][1] = -60; #declare Q[1][1][2] = 75; #declare Q[1][1][3] = -50; #declare Q[1][1][4] = 45; #declare Q[1][2][0] = 0; #declare Q[1][2][1] = -45; #declare Q[1][2][2] = 70; #declare Q[1][2][3] = -45; #declare Q[1][2][4] = 90; #declare Q[1][3][0] = 45; #declare Q[1][3][1] = -45; #declare Q[1][3][2] = 45; #declare Q[1][3][3] = -45; #declare Q[1][3][4] = -45; #declare Q[1][4][0] = 70; #declare Q[1][4][1] = -45; #declare Q[1][4][2] = 45; #declare Q[1][4][3] = -45; #declare Q[1][4][4] = 45; #declare Q[1][5][0] = -45; #declare Q[1][5][1] = 45; #declare Q[1][5][2] = -45; #declare Q[1][5][3] = -45; #declare Q[1][5][4] = -80; #declare Q[2][0][0] = 45; #declare Q[2][0][1] = -45; #declare Q[2][0][2] = 90; #declare Q[2][0][3] = -50; #declare Q[2][0][4] = 45; #declare Q[2][1][0] = -45; #declare Q[2][1][1] = 70; #declare Q[2][1][2] = -45; #declare Q[2][1][3] = -50; #declare Q[2][1][4] = -80; #declare Q[2][2][0] = 45; #declare Q[2][2][1] = -45; #declare Q[2][2][2] = 90; #declare Q[2][2][3] = -45; #declare Q[2][2][4] = 45; #declare Q[2][3][0] = 45; #declare Q[2][3][1] = 0; #declare Q[2][3][2] = 45; #declare Q[2][3][3] = -90; #declare Q[2][3][4] = 45; #declare Q[2][4][0] = -45; #declare Q[2][4][1] = 75; #declare Q[2][4][2] = -45; #declare Q[2][4][3] = -45; #declare Q[2][4][4] = -80; #declare Q[2][5][0] = -45; #declare Q[2][5][1] = -45; #declare Q[2][5][2] = 145; #declare Q[2][5][3] = -45; #declare Q[2][5][4] = 45; #declare Q[3][0][0] = -45; #declare Q[3][0][1] = 45; #declare Q[3][0][2] = -55; #declare Q[3][0][3] = -45; #declare Q[3][0][4] = -100; #declare Q[3][1][0] = -45; #declare Q[3][1][1] = 45; #declare Q[3][1][2] = -45; #declare Q[3][1][3] = 45; #declare Q[3][1][4] = -80; #declare Q[3][2][0] = 45; #declare Q[3][2][1] = -75; #declare Q[3][2][2] = 45; #declare Q[3][2][3] = -45; #declare Q[3][2][4] = 45; #declare Q[3][3][0] = -90; #declare Q[3][3][1] = -45; #declare Q[3][3][2] = 45; #declare Q[3][3][3] = -45; #declare Q[3][3][4] = 45; #declare Q[3][4][0] = 45; #declare Q[3][4][1] = -45; #declare Q[3][4][2] = 45; #declare Q[3][4][3] = -45; #declare Q[3][4][4] = -130; #declare Q[3][5][0] = -45; #declare Q[3][5][1] = 45; #declare Q[3][5][2] = -45; #declare Q[3][5][3] = -45; #declare Q[3][5][4] = 0; #declare Q[4][0][0] = -45; #declare Q[4][0][1] = 0; #declare Q[4][0][2] = 0; #declare Q[4][0][3] = -45; #declare Q[4][0][4] = 45; #declare Q[4][1][0] = 45; #declare Q[4][1][1] = -25; #declare Q[4][1][2] = 145; #declare Q[4][1][3] = -45; #declare Q[4][1][4] = 90; #declare Q[4][2][0] = 45; #declare Q[4][2][1] = -45; #declare Q[4][2][2] = -45; #declare Q[4][2][3] = 45; #declare Q[4][2][4] = -80; #declare Q[4][3][0] = 45; #declare Q[4][3][1] = -45; #declare Q[4][3][2] = 85; #declare Q[4][3][3] = -45; #declare Q[4][3][4] = 10; #declare Q[4][4][0] = 45; #declare Q[4][4][1] = -45; #declare Q[4][4][2] = 45; #declare Q[4][4][3] = -45; #declare Q[4][4][4] = -45; #declare Q[4][5][0] = -75; #declare Q[4][5][1] = -45; #declare Q[4][5][2] = 45; #declare Q[4][5][3] = -45; #declare Q[4][5][4] = 45; #declare Q[5][0][0] = 45; #declare Q[5][0][1] = -45; #declare Q[5][0][2] = 45; #declare Q[5][0][3] = -45; #declare Q[5][0][4] = 45; #declare Q[5][1][0] = 45; #declare Q[5][1][1] = -45; #declare Q[5][1][2] = 45; #declare Q[5][1][3] = -45; #declare Q[5][1][4] = 45; #declare Q[5][2][0] = 45; #declare Q[5][2][1] = -45; #declare Q[5][2][2] = 45; #declare Q[5][2][3] = -45; #declare Q[5][2][4] = 45; #declare Q[5][3][0] = 45; #declare Q[5][3][1] = -45; #declare Q[5][3][2] = 45; #declare Q[5][3][3] = -45; #declare Q[5][3][4] = 45; #declare Q[5][4][0] = 45; #declare Q[5][4][1] = -45; #declare Q[5][4][2] = 45; #declare Q[5][4][3] = -45; #declare Q[5][4][4] = 45; #declare Q[5][5][0] = 45; #declare Q[5][5][1] = -45; #declare Q[5][5][2] = 45; #declare Q[5][5][3] = -45; #declare Q[5][5][4] = 45; #declare tk = vetorK(n_chaves); #declare B = array[n_pernas][n_graus]; #for (i, 0, n_pernas-1, 1) #for (j, 0, 4, 1) #declare B[i][j] = 0; #end #end #declare nk = buscaTempo(clock, n_chaves, tk); #declare clk = clock; cena(Q, nk, nk+1, B, n_pernas, n_graus, n_chaves, clk) #include "camlight.inc" #declare centro_cena = < 0, 0, 0 >; #declare raio_cena = 50; #declare dir_camera = < 10.00, 30.00, 5.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)