// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2023-10-18 10:05:43 by stolfilocal // ====================================================================== // 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 2.2*< 0.40, 0.01, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } // Partes da cena: #declare rbola = 2.500; #declare bola = sphere{ < 0.00, 0.00, 0.00 >, rbola 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 #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 #include "bezpoly.inc" #macro teste_interpola3_multi(n, p0, P1, P2, p3, qtde, raio) union { object{ bezpoly_multi(n, p0, P1, P2, p3, 0.9*raio) } #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 P2 = array[n]; #local P1[0] = < 0, 1, -1>; #local P2[0] = < 2, 1, 3>; #local P1[1] = < 6, 3, 2>; #local P2[1] = < 0, 4, 5>; #local P1[2] = < -1, -3, 7>; #local P2[2] = < 5, 5, 9>; #include "eixos.inc" #local Pfin = <3, 7, 6>; union{ //object{ eixos(10.00) } object { teste_interpola3_multi(n, Pini, P1, P2, Pfin, qtde, 0.10) } } #declare cmin = < -4.5, -4.5, -1.5 >; #declare cmax = < +8.0, +8.0, +9.9 >; 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.5*vlength(cmin - cmax); #declare dir_camera = < -7, 4, 3 >; #declare dist_camera = 7*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)