// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2017-05-07 20:10:09 by stolfilocal // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.20, 0.40, 0.60 > } #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_alt = texture{ pigment{ color rgb < 0.10, 0.40, 0.20 > transmit 0.91 } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_alt2 = texture{ pigment{ color rgb < 0.70, 0.40, 0.50 > transmit 0.81 } 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_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.50, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 3.0 } // ====================================================================== // DESCRIÇÃO DA CENA #declare raio = 1.500; // Partes da cena: #declare N = 100; #declare f = 0; #declare g = 0; #declare R = array[4][4]; #while(f<4) #while(g<4) #declare R[f][g] = <0,0,0>; #declare g = g+1; #end #declare f = f+1; #end #macro interpola(t0,u0,t1,u1,tt) #local r = (tt-t0)/(t1-t0); #local s = 1-r; #local uu = s*u0 +r*u1; uu #end #macro arcobezier(t0,t1,A,B,C,D,tt) #local AB = interpola(t0,A,t1,B,t0); #local BC = interpola(t0,B,t1,C,tt); #local CD = interpola(t0,C,t1,D,tt); #local ABC = interpola(t0,AB,t1,BC,tt); #local BCD = interpola(t0,BC,t1,CD,tt); #local ABCD = interpola(t0,ABC,t1,BCD,tt); ABCD #end #macro arco (n,t0,t1,a,b,c,d) #local i = 0; #local tt = 0; #while (i < n) #local centro = arcobezier(t0, t1, a, b, c, d, tt); sphere { centro, 0.3 texture {tx_alt2} } #local tt = tt + 1/n; #local i = i +1; #end #end #declare P = array[4][4] { {<0,0,0>, <5, 0, 5>, <2.5, 0, 2.5>, <2.5, 0, 5>}, {<0,0,0>, <-2.5, 0, -2.5>, <-4.5, 0, -5>, <-2.5, -1, -6>}, {<2.5,0,5>, <1, 2.5, 2.5>, <1.5, 3.5, 1.5>, <1.5, 1.5, 0>}, {<-2.5,-1,-6>, <2.5, -1, -2>, <3.5, -1, 0>, <1.5, 1.5, 0>} }; #declare Q = array[4][4] { {<-5,0,0>, <5, 0, 5>, <2.5, 0, 2.5>, <2.5, 10, 5>}, {<-5,0,0>, <-2.5, 5, -2.5>, <-4.5, 0, -5>, <-6, -1, -4>}, {<2.5,10,5>, <1, 2.5, 2.5>, <1.5, 3.5, 1.5>, <1.5, 1.5, 0>}, {<-6,-1,-4>, <2.5, -1, -2>, <3.5, -1, 0>, <1.5, 1.5, 0>} }; #macro suaviza(P,n,i) #local j = mod(i+1,n); #local uu = (P[j][1] - P[i][2])/2; #declare P[i][2] = P[i][3] - uu; #declare P[j][1] = P[j][0] + uu; #end //P = matriz dos pontos, n = numero de arcos, m = numero de bolinhas que compoem //uma curva //arco (n,t0,t1,a,b,c,d) #macro noh(P,n,m) #local i = 0; #while (i < n) arco(m,0,1,P[i][0],P[i][1],P[i][2],P[i][3]) #local i = i+1; #end #end //N = numero de linhas da matriz //Define cada elemento R[i][k] //interpolando linearmente P[i][k] //e Q[i][k], para cc entre c0 e c1 #macro interpola1matriz(P,Q,X,c0,c1,cc,R) #local i=0; #while(i < X) #local k = 0; #while(k < 4) #declare R[i][k]=interpola(c0,P[i][k],c1,Q[i][k],cc); #local k = k+1; #end #local i = i+1; #end #end #include "eixos.inc" // Aqui está a cena, finalmente: object { eixos(4.00) } #local i = 0; #while (i<4) suaviza(Q, 3, i) #local i = i +1; #end #local dd= 0; #while(dd <= 1) interpola1matriz(P,Q,4,0,1,dd,R) noh(R,4,N) #local dd = dd+0.25; #end #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 20.0; #declare dir_camera = < 7.00, 2.00, 4.00 >; #declare dist_camera = 4*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz) //object {chao translate <0,0,-6> texture {tx_xadrez}} //sphere{<0,0,0>, 0.6 texture{tx_alt}} //sphere{<5,0,5>, 0.6 texture{tx_alt}} //sphere{<2.5,0,2.5>, 0.6 texture{tx_alt}} //sphere{<2.5,0,5>, 0.6 texture{tx_alt}} //sphere{<0,0,0>, 0.3 texture{tx_plastico}} //sphere{<-2.5,0,-2.5>, 0.3 texture{tx_plastico}} //sphere{<-4.5,0,-5>, 0.3 texture{tx_plastico}} //sphere{<-2.5,0,-6>, 0.3 texture{tx_plastico}} //sphere{<2.5,0,5>, 0.6 texture{tx_xadrez}} //sphere{<1,2.5,2.5>, 0.6 texture{tx_xadrez}} //sphere{<1.5,3.5,1.5>, 0.6 texture{tx_xadrez}} //sphere{<1.5,1.5,0>, 0.6 texture{tx_xadrez}} //sphere{<-2.5,0,-6>, 0.6 texture{tx_alt2}} //sphere{<2.5,-1,-2>, 0.6 texture{tx_alt2}} //sphere{<3.5,-1,0>, 0.6 texture{tx_alt2}} //sphere{<1.5,1.5,0>, 0.6 texture{tx_alt2}}