// Last edited on 2023-12-22 20:05:16 by stolfi // Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2023-12-22 20:04:35 by stolfi // ====================================================================== // 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) object { tanque_a translate} #end #macro tanque2(xx, yy) object { tanque_b translate} #end #macro tanque3(xx, yy) object { tanque_c translate} #end #macro tubo(p, q) cylinder{ < p.x, p.y, 8.00 >, < q.x, q.y, 8.00 >, 0.3 texture{ tx_fosca } } #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 #declare D = 20; #macro gera_grafo(nv, ne, org, dst, na, nb) union { #local umaseed = seed(342321); #local pontos = array[nv]; #local deg = array[nv]; #for(j, 0, nv - 1) #local deg[j] = 0; #end #for(k, 0, ne - 1) #local deg[org[k]] = deg[org[k]] + 1; #local deg[dst[k]] = deg[dst[k]] + 1; #end #local i = 0; #while(i < nv) #local vx = rand(umaseed) * D; #local vy = rand(umaseed) * D; #local vz = rand(umaseed) * D; #local pontos[i] = ; #local grau = deg[i]; object { vertice(grau) translate } #local i = i + 1; #end #for(i, 0, ne - 1) #local pini = pontos[org[i]]; #local pfin = pontos[dst[i]]; object { conecta(na, nb, pini, 0, pfin, 0) } #end } #end #macro vertice(grau) #if(grau = 2) object { vet_grau_2() } #end #if(grau = 3) object { vet_grau_3() } #end #if(grau = 4) object { vet_grau_4() } #end #end #macro vet_grau_2() object { tanque_c } #end #macro vet_grau_3() object { tanque_b } #end #macro vet_grau_4() object { tanque_a } #end #macro conecta(na, nb, pini, tini, pfin, tfin) #local p1 = array[na]; #local p2 = array[na]; #for(i, 0, na - 1) #local vx = rand(umaseed) * 20; #local vy = rand(umaseed) * 20; #local vz = rand(umaseed) * 20; #local vx2 = rand(umaseed) * 20; #local vy2 = rand(umaseed) * 20; #local vz2 = rand(umaseed) * 20; #local p1[i] = ; #local p2[i] = ; #end #local p1[0] = pini; #local p2[na - 1] = pfin; union { #local bolas = na * nb; object { teste_interpola3_multi(na, pini, p1, p2, pfin, bolas, 0.25) } // object { teste_interpola3_multi(na, tini, p1, p2, tfin, bolas, 1) } } #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 nv = 4; #local ne = 6; #local org = array[ne]; #local dst = array[ne]; #local org[0] = 0; #local org[1] = 2; #local org[2] = 2; #local org[3] = 3; #local org[4] = 1; #local org[5] = 3; #local dst[0] = 2; #local dst[1] = 0; #local dst[2] = 1; #local dst[3] = 0; #local dst[4] = 3; #local dst[5] = 3; object { gera_grafo(nv, ne, org, dst, 2, 100) } #declare cmin = < 0, 0, 0 >; #declare cmax = < D, D, D >; #include "gaiola.inc" // object{ gaiola(cmin,cmax) } #declare centro_cena = (cmin + cmax)/2; #declare raio_cena = 0.60*vlength(cmax-cmin); #declare dist_camera = 7*raio_cena; #include "camlight.inc" #declare dir_camera = < 7, 7, 5.00 >; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)