// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_vidro = texture{ pigment{ color rgb < 1, 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_plastico = texture{ pigment{ color rgb < 0.50, 0.90, 0.50 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 0.40, 0.01, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } // ====================================================================== // DESCRI��O DA CENA #declare raio = 2.500; // Partes da cena: #declare bola = sphere{ < 0.00, 0.00, 0.00 >, raio texture{ tx_plastico } } #declare caixa = box{ <-1,-2,0>, <+1,2,1> texture{ tx_plastico }} #declare perna = cylinder{ < 0.00, +0.00, 0.00 >, < 0.00, 0.00, +5.00 >, 0.5 texture{ tx_plastico } } #declare bolinha = sphere{ < 0, 0, 0 >, 1 texture{ tx_plastico } } #declare bolona = sphere{ < 0, 0, 0 >, 1.5 texture{ tx_plastico } } #declare tanque_cone = cone{ < 0, 0, 0 >, 1 < 0, 0, 3.00 >, 0.5 texture{ tx_plastico } } #declare cano = cylinder{ < 0.00, +0.00, -2.00 >, < 0.00, 0.00, +2.00 >, 0.3 texture{ tx_fosca } } #declare cano_h = cylinder{ < 0.00, +0.00, 0.00 >, < 0.00, 2.00, +.00 >, 0.3 texture{ tx_fosca } } #declare tanque_a = union { object { perna } object { bolona translate < 0,0,5>} object { cano translate < 0,1,7>} object { cano translate < 0,-1,7>} object { cano_h translate < 0,0,3> } object { cano_h translate < 0,-2,3> } } #declare tanque_b = union { object { tanque_cone } object { caixa translate < 0,0,3>} object { cano translate < 0,0,3>} object { cano_h translate < 0,1,3.5> } object { cano_h translate < 0,-3,3.5> } } #declare tanque_c = union { object { bolinha } object { perna } object { bolinha translate < 0,0,5>} object { cano translate < 0,0,5>} object { cano_h translate < 0,1,5> } // object { cano_h translate < 0,-3,5> } } #macro tabuleiro_dentro(r) cylinder{ < 0.00, +0.00, -2.00 >, < 0.00, 0.00, 1.00 >, r texture{ tx_plastico } } #end #macro tabuleiro_fora(r) cylinder{ < 0.00, +0.00, -1.00 >, < 0.00, 0.00, 0.00 >, r texture{ tx_fosca } } #end #macro faixa(r) difference { object { tabuleiro_fora(r) } object { tabuleiro_dentro(r - 3) } } #end #macro tanque1(xx, yy) union { object { tanque_a translate} } #end #macro tanque2(xx, yy) union { object { tanque_b translate} } #end #macro tanque3(xx, yy) union { object { tanque_c translate} } #end #macro tubo(p, q) union { cylinder{ < p.x, p.y, 8.00 >, < q.x, q.y, 8.00 >, 0.3 texture{ tx_fosca } } } #end // #declare NMAX = 1000; // #declare A = array[NMAX]; // #declare N = 0; // #declare m = 4; // #declare n = 4; // #declare tam_array = n * m; // #declare roleta1 = seed(1234); // #declare esp = 7; // #declare cont = 0; // #macro gera_tanques(m, n) // union { // #for(i, 0, m - 1) // #for(j, 0, n - 1) // #declare A[cont] = ; // #declare cont = cont + 1; // #declare tanq_n = floor(3*rand(roleta1)); // #if (tanq_n = 0) // object { tanque1(i * esp, j * esp) } // #end // #if (tanq_n = 1) // object { tanque2(i * esp, j * esp) } // #end // #if (tanq_n = 2) // object { tanque3(i * esp, j * esp) } // #end // #end // #end // } // #end // #macro gera_tubulacoes() // union { // #for(j, 0, cont - 2) // #declare atual = A[j]; // #declare novo_idx = (tam_array)*rand(roleta1); // #declare novo = A[novo_idx]; // #declare A[j] = novo; // #declare A[novo_idx] = atual; // #end // #for(i, 0, cont - 2) // object { tubo(A[i], A[i + 1]) } // #end // } // #end #macro interpola1(ti, t0, v0, t1, v1) #local ss = (ti - t0) / (t1 - t0); #local vv = (1 - ss)*v0 + ss*v1; vv #end #macro interpola3(ti, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(ti, ta, v0, tb, v1); #local v12 = interpola1(ti, ta, v1, tb, v2); #local v23 = interpola1(ti, ta, v2, tb, v3); #local v012 = interpola1(ti, ta, v01, tb, v12); #local v123 = interpola1(ti, ta, v12, tb, v23); #local v0123 = interpola1(ti, ta, v012, tb, v123); v0123 #end #macro teste_interpola(p0, p1, n, raio) union { #for(k, 0, n) #local centro = interpola1(k, 0, p0, n, p1); sphere{ centro, raio texture{ tx_fosca } } #end } #end #macro teste_interpola3(p0, p1, p2, p3, n, raio) union { #for(k, 0, n) #local centro = interpola3(k, 0, n, p0, p1, p2, p3); sphere{ centro, raio texture{ tx_fosca } } #end } #end #macro interpola3_multi(ti, n, p0, P1, P2, pf) #local k = int(ti); #local q0 = p0; #local q3 = pf; #local q1 = P1[k]; #local q2 = P2[k]; #if(k > 0) #local q0 = (P2[k - 1] + P1[k]) / 2; #end #if(k < n - 1) #local q3 = (P2[k] + P1[k + 1]) / 2; #end // definir q0, q1, q2, q3 #local pt = interpola3(ti, k, k + 1, q0, q1, q2, q3); pt #end #macro teste_interpola3_multi(n, p0, P1, P2, p3, qtde, raio) union { #local k = 0; #while(k < n) #local centro = interpola3_multi(k, n, p0, P1, P2, p3); sphere{ centro, raio texture{ tx_fosca } } #local k = k + n / qtde; #end } #end #local Pini = <0,0,0>; #local qtde = 300; #local n = 3; #local P1 = array[n]; #local P1[0] = <0, 1, -1>; #local P1[1] = <0, 1, 2>; #local P1[2] = <0, -3, 7>; #local P2 = array[n]; #local P2[0] = <0, 1, 3>; #local P2[1] = <0, 1, 5>; #local P2[2] = <0, 5, 9>; #include "eixos.inc" // #local Pini = <0,0,0>; // #local qtde = 300; // #local n = 3; // #local P1 = array[n]; // #local P1[0] = <0, 1, -1>; // #local P1[1] = <0, 3, 0>; // #local P1[2] = <0, 3, 7>; // #local P2 = array[n]; // #local P2[0] = <0, 2, 2>; // #local P2[1] = <0, 0, -2>; // #local P2[2] = <0, 5, 9>; union{ object{ eixos(5.00) } // object { tanque_c } // object { tanque_b translate<10, 0, -5> } // object { gera_tanques(m, n) } // object { gera_tubulacoes() } // object { teste_interpola(<0, 0, 0>, <0, 10, 10>, 10, 1) } // object { teste_interpola3(<0, 0, 0>, <0, 10, 10>, <0, 20, 5>, <0, 20, -5>, 20, 1) } // object { teste_interpola3(<0, 0, 0>, <0, 10, 10>, <0, 10, 0>, <0, 10, 5>, 10, 1) } // object { teste_interpola3(<0, 3, 5>, <5, 0, 20>, <7, 2, 0>, <10, 3, -1.5>, 500, 0.25) } object { teste_interpola3_multi(n, Pini, P1, P2, <0, 7, 6>, qtde, 0.25) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 10; #declare dir_camera = < 7, 0, 5.00 >; #declare dist_camera = 7*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)