// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2023-12-23 18:29:51 by stolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.3, 0.3, 0.3 > } #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.00, 0.00 > } 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 s = seed(10); #declare A = array[1000]; #declare total = 0; #macro torre1(cx,cy,cz) union { object { sphere { <0, 0, 0.33>, 0.33 texture {tx_plastico} pigment { color rgb < 0.00, 1.00, 0.00 > } translate } } cylinder {<0,0.25,0.5>, <0,0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } } #declare A[total] = ; #end #macro torre2(cx,cy,cz) union { object {intersection { cone{ <0,0,0>,0.5 <0,0,1>,0 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 0.00 > }} box{ <-0.25,-0.25,0>, <0.25,0.25,1> texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 0.00 >}} } translate } cylinder {<0,0.25,0.5>, <0,0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } cylinder {<0,-0.25,0.5>, <0,-0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } } #declare A[total] = ; #declare total = total + 1; #declare A[total] = ; #declare total = total + 1; #end #macro torre3(cx,cy,cz) union { cylinder { <0,0,0>, <0,0,0.5>, 0.25 texture {tx_plastico} pigment { color rgb < 1.00, 0.00, 0.00 > } translate } cone{ <0,0,0.5>, 0.25 <0,0,1>, 0 texture {tx_plastico} pigment { color rgb < 1.00, 0.00, 0.00 >} translate } cylinder {<0,0.25,0.5>, <0,0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } cylinder {<0,-0.25,0.5>, <0,-0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } cylinder {<0.25,0,0.5>, <0.3,0,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } } #declare A[total] = ; #declare total = total + 1; #declare A[total] = ; #declare total = total + 1; #declare A[total] = ; #declare total = total + 1; #end #macro torre4(cx,cy,cz) union { box{ <-0.25,-0.25,0>, <0.25,0.25,0.5> texture {tx_plastico} pigment { color rgb < 0.00, 0.00, 1.00 >} translate } cylinder { <0,0,0.5>, <0,0, 1>, 0.25 texture {tx_plastico} pigment { color rgb < 0.00, 0.00, 1.00 > } translate } cylinder {<0,0.25,0.5>, <0,0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } cylinder {<0,-0.25,0.5>, <0,-0.3,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } cylinder {<0.25,0,0.5>, <0.3,0,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } cylinder {<-0.25,0,0.5>, <-0.3,0,0.5> 0.05 texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > } translate } } #declare A[total] = ; #declare total = total + 1; #declare A[total] = ; #declare total = total + 1; #declare A[total] = ; #declare total = total + 1; #declare A[total] = ; #declare total = total + 1; #end #macro interpola1(tt,t0,v0,t1,v1) #local ss = (tt-t0)/(t1-t0); #local vv = (1-ss)*v0 + ss*v1; vv #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 interpola3_multi(tt, pini, n, ap1, ap2, pfim) //k = 0, k = n-1 #local k = int(tt); #if (k = 0) #local q0 = pini; #else #local q0 = (ap2[k-1] + ap1[k])/2; #end #local q1 = ap1[k]; #local q2 = ap2[k]; #if (k = n-1) #local q3 = pfim; #else #local q3 = (ap2[k] + ap1[k+1])/2; #end #local pt = interpola3(tt, k, k+1, q0, q1, q2,q3); pt #end #macro testa_interpola_1(p0,p1,n,raio) union { #for(i,0,n) #local centro = interpola1(i,0,p0,n,p1); sphere {centro, raio texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > }} #end } #end #macro testa_interpola_3(v0,v3,n,raio) #local a1 = 4.0*rand(s)-2; #local a2 = 4.0*rand(s)-2; #local v1 = <(v0.x+v3.x)/3, (v0.y + v3.y)/3, a1>; #local v2 = <(2*(v0.x+v3.x))/3, (2*(v0.y+v3.y))/3, a2>; union { #for(i,0,n) #local centro = interpola3(i,0,n,v0,v1,v2,v3); sphere {centro, raio texture {tx_plastico} pigment { color rgb < 1.00, 1.00, 1.00 > }} #end } #end #declare raio = 0.01; #macro conector(na,pini,tini,pfin,tfin, D, nb) #local p1 = array[na]; #local p2 = array[na]; #for (i,0,na-1) #local p1[i] = ; #local p2[i] = ; #end /*#local p1[0] = tini; #local p2[na-1] = tfin;*/ union { #local i = 0; #while (i }} #local i = i+1/nb; #end } #end #macro gera_grafo(nv, ne, org, dst, D, na, nb) #local vscale = 0.5; #local npontos = array[nv]; #local posicoes = array[nv]; #for(i,0,nv-1) #local npontos[i] = 0; #end #for(i, 0, ne-1) #local npontos[org[i]] = npontos[org[i]] +1; #local npontos[dst[i]] = npontos[dst[i]] +1; #end #for(i,0,nv-1) #local posicoes[i] = ; #if (npontos[i]=1) object {torre1(posicoes[i].x,posicoes[i].y,posicoes[i].z) scale vscale} #end #if(npontos[i]=2) object {torre2(posicoes[i].x,posicoes[i].y,posicoes[i].z) scale vscale} #end #if(npontos[i]=3) object {torre3(posicoes[i].x,posicoes[i].y,posicoes[i].z) scale vscale} #end #if(npontos[i]=4) object {torre4(posicoes[i].x,posicoes[i].y, posicoes[i].z) scale vscale} #end #end #for(i,0,ne-1) #if (0 = 0) conector(4,posicoes[org[i]], 0, posicoes[dst[i]], 0, D, 500) #end #end #end #include "eixos.inc" #local nv = 4; #local ne = 6; #local org = 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 = array[ne]; #local dst[0] = 2; #local dst[1] = 0; #local dst[2] = 1; #local dst[3] = 0; #local dst[4] = 3; #local dst[5] = 3; #local D = 3.0; gera_grafo(nv,ne,org,dst,D, 0,0) #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.47*vlength(cmax-cmin); #declare dist_camera = 5*raio_cena; #include "camlight.inc" #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)