// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2023-10-23 20:31:21 by stolfilocal // ====================================================================== // CORES E TEXTURAS #declare semente = seed(42); #declare M = 500; #declare N = 500; #declare A = array[M*N]; #declare num_ponta_tanque = 0; 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_verde = texture{ pigment{ color rgb < 0.20, 0.99, 0.20 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_vermelho = texture{ pigment{ color rgb < 1.00, 0.01, 0.20 > } 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 } // ====================================================================== // DESCRI��O DA CENA #declare raio = 2.000; // Partes da cena: #declare chao = box{ <-200,-200,-1>, <+200,+200,0> } #include "eixos.inc" #macro gera_tanque1(xx, yy, zz) union { sphere { , 1 // , radius texture {tx_plastico} } cylinder { , <2+xx, yy, zz>, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_verde} } } #end #macro gera_tanques2(xx, yy) union { #local p1 = ; #local q1 = ; #local q2 = <2+xx, yy, 0.7>; #local q3 = ; #declare A[num_ponta_tanque] = q1; #declare num_ponta_tanque = num_ponta_tanque + 1; box { , // near lower left corner, far upper right corner texture {tx_plastico} } cone { , 0.25 // , center & radius of one end , 1 // , center & radius of the other end texture {tx_plastico} } cylinder { , q1, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , q2, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , q3, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } } #end #macro gera_tanquesB(xx, yy) union { #local p1 = ; #local q1 = ; #local q2 = <2+xx, yy, 0.7>; #local q3 = ; #declare A[num_ponta_tanque] = q1; #declare num_ponta_tanque = num_ponta_tanque + 1; cylinder { , , 1 // center of one end, center of other end, radius texture {tx_plastico} } box { , // near lower left corner, far upper right corner texture {tx_plastico} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , <2+xx, yy, 0.7>, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } } #end #macro gera_tanques3(xx, yy, zz) union { #local p1 = ; #local q1 = ; #local q2 = <2+xx, yy, 0.7+zz>; #local q3 = ; #declare A[num_ponta_tanque] = q1; #declare num_ponta_tanque = num_ponta_tanque + 1; box { , // near lower left corner, far upper right corner texture {tx_plastico} } sphere { , 1 // , radius texture {tx_plastico} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , <2+xx, yy, 0.7+zz>, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_verde} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } } #end #macro interpola1(tt, t0, v0, t1, v1) #local ss = (tt-t0)/(t1-t0); #local vv = (1-ss)*v0+ss*v1; vv #end #macro testa_interpola(p0, p1, n, raio) union { #local n_atual = 0; #while(n_atual, radius texture {tx_fosca} } #local n_atual = n_atual +1; #end } #end #macro interpola3(tt, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(tt, ta, v0, tb, v1); #local v12 = interpola1(tt, ta, v1, tb, v2); #local v23 = interpola1(tt, ta, v2, tb, v3); #local v012 = interpola1(tt, ta, v01, tb, v12); #local v123 = interpola1(tt, ta, v12, tb, v23); #local v0123 = interpola1(tt, ta, v012, tb, v123); v0123 #end #macro testa_interpola3(p0, p1, n, raio, v1, v2, ta, tb) union { #local n_atual = 0; #while(n_atual, radius texture {tx_fosca} } #local n_atual = n_atual + 0.01; #end } #end #macro calcula_ponto_medio(pontoA, pontoB) #local ponto_medio = (pontoA + pontoB) / 2; ponto_medio #end #macro interepola3_multi(tt, p_ini, n, p1, p2, p_fim) #local k = int(tt); // #local q3 = #if(tt = 0) #local q0 = p_ini; #elseif(tt = k) #local q0 = (p2[k-1] + p1[k])/2; #else #local q0 = tt; //Precisa ser um ponto #end #if(tt = 3) #local q3 = p_fim; #elseif(tt = k & tt>0) #local q3 = calcula_ponto_medio(p2[k-1], p1[k]); #else #local q3 = tt; #end #local resultado = interpola3(tt, k, k+1, q0, p1[k], p2[k], q3); resultado #end #include "bezpoly.inc" #macro testa_interpola3_multi() #local p_inicial = <0,-1,0>; #local n = 3; #local raio = 0.1; #local P1 = array[n]; #local P1[0] = <5,-2,0>; #local P1[1] = <3,-2,8>; #local P1[2] = <6,-2,4>; #local P2 = array[n]; #local P2[0] = <3, 0,5>; #local P2[1] = <8, 0,5>; #local P2[2] = <5, 0,2>; #local p_final = <5,-1,3>; #local t_atual = 0; union { object{ bezpoly_multi(n, p_inicial, P1, P2, p_final, 0.9*raio) } #while(t_atual < n) #local posicao_centro = interepola3_multi(t_atual, p_inicial, n, P1, P2, p_final); sphere { posicao_centro, raio // , radius texture {tx_fosca} } #local t_atual = t_atual+0.001; #end } #end object{testa_interpola3_multi()} #macro gera_conexao_entre_tanques(posicao_tanque_A, posicao_tanque_B, n, curva1, curva2) union { #local ta = 0; #local tb = 10; #local raio = 0.1; gera_tanque1(posicao_tanque_A.x, posicao_tanque_A.y, posicao_tanque_A.z) gera_tanques3(posicao_tanque_B.x, posicao_tanque_B.y, posicao_tanque_B.z) box { , // near lower left corner, far upper right corner } box { , // near lower left corner, far upper right corner } //<2+xx, yy, 0.7+zz> #local ponta_tanque3 = ; //<2+xx, yy, zz> #local ponta_tanque1 = <2+posicao_tanque_A.x, posicao_tanque_A.y, posicao_tanque_A.z>; #local n_atual = 0; #while(n_atual, radius texture {tx_fosca} } #local n_atual = n_atual + 0.01; #end } #end #macro gera_tanques_grade(m, n) #local tipo_tanque = int(3*rand(semente)); #if(tipo_tanque = 0) object {gera_tanquesA(m, n)} #end #if(tipo_tanque = 1) object {gera_tanquesB(m, n)} #end #if(tipo_tanque = 2) object {gera_tanquesC(m, n)} #end #end union{ object{ eixos(3.00) } object{ chao translate < 0,0,-5 > texture{ tx_xadrez } } } #include "eixos.inc" // object{ eixos(10) } #declare cmin = < -1, -3, -0.5 >; #declare cmax = < +9, +4, +9.5 >; box{ cmin-0.1*z, texture{ pigment{ color rgb <0.80,0.70,0.60> } finish {diffuse 0.7 ambient 0.3 } } } #include "camlight.inc" #declare centro_cena = (cmin + cmax)/2; #declare raio_cena = 0.55*vlength(cmin - cmax); #declare dir_camera = < 20.00, 17.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)