// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2023-10-12 01:22:58 by stolfilocal #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_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.80, 0.85, 0.90 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare tx_bug = texture{ pigment{ color rgb < 1.000, 0.200, 0.000 > } finish{ diffuse 0.5 ambient 0.5 } } #declare raio = 2.000; // Partes da cena: #declare tanqueA = union { union { box { <-1, -1, 0>, <1, 1, 0.2> // near lower left corner, far upper right corner texture {tx_plastico} } cone { <0, 0, 0.2>, 0.25 // , center & radius of one end <0, 0, 1.3>, 1 // , center & radius of the other end texture {tx_plastico} } } } #declare tanqueB = union { union { cylinder { <0, 0, 0>, <0, 0, 1>, 1 // center of one end, center of other end, radius texture {tx_plastico} } box { <-0.6, -0.6, 1>, <0.6, 0.6, 1.6> // near lower left corner, far upper right corner texture {tx_plastico} } } } #declare tanqueC = union { union { box { <-1, -1, 0>, <1, 1, 2> // near lower left corner, far upper right corner texture {tx_plastico} } sphere { <0, 0, 2>, 1 // , radius texture {tx_plastico} } } } #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 // object{testa_interpola(<0,0,0>, <10,10,10>, 10, 0.5)} #include "bezpoly.inc" #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) //<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>; object{ bezpoly(ponta_tanque1, curva1, curva2, ponta_tanque3, 0.8*raio) texture {tx_bug } } #local n_atual = 0; #while(n_atual, radius texture {tx_fosca} } #local n_atual = n_atual + 0.01; #end } #end // object {testa_interpola3(<0,0,0>, <10,10,10>, 500, 0.05, <10,3,5>, <7,2,9>, 0, 10)} #macro gera_tanques_grade(m, n) #local tipo_tanque = int(3*rand(semente)); #if(tipo_tanque = 0) // object {gera_tanquesA(m, n)} // Não definido - Prof. object {gera_tanquesB(m, n)} #end #if(tipo_tanque = 1) object {gera_tanquesB(m, n)} #end #if(tipo_tanque = 2) // object {gera_tanquesC(m, n)} // Não definido - Prof. object {gera_tanquesB(m, n)} #end #end // #macro gera_tubulacoes(p, q) // union { // cylinder { // p, , 0.1 // center of one end, center of other end, radius // } // } // #end // #declare m_atual = 0; // #while(m_atual < M) // #declare n_atual = 0; // #while(n_atual < N) // object {gera_tanques_grade(m_atual, n_atual)} // #declare n_atual = n_atual + 10; // #end // #declare m_atual = m_atual + 10; // #end // #declare ponta_tanque_atual = 0; // #while(ponta_tanque_atual < M*N) // object{gera_tubulacoes(ponta_tanque_atual, ponta_tanque_atual)} // #declare ponta_tanque_atual = ponta_tanque_atual + 1; // #end #declare nnx = 3; #declare nny = 2; union{ // object{ eixos(10.00) } object{ chao translate < 0,0,-5 > texture{ tx_xadrez } } object {gera_tanques_grade(nnx, nny)} object{gera_conexao_entre_tanques(<2,5,1>, <0,7,3>, 10, <5,5,5>, <7,7,7>)} } #declare cmin = < -0.7, -0.7, -0.5 >; #declare cmax = < +5.7, +8.7, +7.5 >; box{ cmin, 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.6*vlength(cmin - cmax); #declare dir_camera = < 20.00, -17.00, 14.00 >; // < 0.001, 0.000, 1.000 >; // #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)