// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2010-03-04 15:44:01 by stolfi // ====================================================================== // CORES E TEXTURAS background { color rgb <0.80, 0.80, 0.80> } // ====================================================================== // DESCRIÇÃO DA CENA // Partes da cena: #include "eixos.inc" #include "colors.inc" #macro ponto(w) object { sphere { <0, 0, 0>, 0.1 } pigment { color rgb <1, 0.4, 0.4> filter 0.8 } translate w } #end #macro quadro_anterior(fase) #local i = 0; #while(i= fase) ) #local resp = i; #end #local i = i+1; #end resp #end #macro interpola2(f0, v0, f1, v1, f) #local ss = (f-f0)/(f1-f0); #local rr = 1-ss; (rr*v0 + ss*v1) #end #macro interpola(t0, v0, v1, v2, v3, t1, tt) #local v01 = 0; #local v12 = 0; #local v23 = 0; #local v012 = 0; #local v123 = 0; #local v0123 = 0; #local v01 = interpola2(t0, v0, t1, v1, tt); #local v12 = interpola2(t0, v1, t1, v2, tt); #local v23 = interpola2(t0, v2, t1, v3, tt); #local v012 = interpola2(t0, v01, t1, v12, tt); #local v123 = interpola2(t0, v12, t1, v23, tt); #local v0123 = interpola2(t0, v012, t1, v123, tt); v0123 #end #macro trecho(x0, y0, y1, y2, y3, x3, N) #local tam = (x3 - x0) / N; #local xx = x0; #local yy = 0; union { #while (xx <= x3) #local yy = interpola(x0, y0, y1, y2, y3, x3, xx); #local xx = xx + tam; object { ponto() } #end } #end #macro trecho2(x0, y0, y1, y2, y3, x3, N) #local tam = (x3 - x0) / N; #local xx = x0; #local yy = 0; union { #while (xx <= x3) #local yy = interpola(x0, y0, y1, y2, y3, x3, xx); #local xx = xx + tam; object { ponto(yy) } #end } #end #declare numPontos = 30; #macro grafico(x0, x1, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10) #local tam = (x1 - x0) / 4; union { trecho(x0, y1, y2, y3, (y3 + y4) / 2, x0 + tam, numPontos) trecho(x0 + tam, (y3 + y4) / 2, y4, y5, (y5 + y6) / 2, x0 + 2*tam, numPontos) trecho(x0 + 2*tam, (y5 + y6) / 2, y6, y7, (y7 + y8) / 2, x0 + 3*tam, numPontos) trecho(x0 + 3*tam, (y7 + y8) / 2, y8, y9, y10, x1, numPontos) } #end #macro grafico2(x0, x1, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10) #local tam = (x1 - x0) / 4; union { trecho2(x0, y1, y2, y3, (y3 + y4) / 2, x0 + tam, numPontos) trecho2(x0 + tam, (y3 + y4) / 2, y4, y5, (y5 + y6) / 2, x0 + 2*tam, numPontos) trecho2(x0 + 2*tam, (y5 + y6) / 2, y6, y7, (y7 + y8) / 2, x0 + 3*tam, numPontos) trecho2(x0 + 3*tam, (y7 + y8) / 2, y8, y9, y10, x1, numPontos) } #end // Aqui está a cena, finalmente: union { // Grafico simples grafico(0, 60, 8, 8, 15, 25, 3, 5, 20, 40, 8, 8) // Grafico bizarro grafico2(0, 60, <1, 4, 5>, <2, 5, 6>, <1, 1, 1>, <2, 2, 2>, <3, 3, 3>, <1, 2, 3>, <8, 4, 5>, <2, 8, 3>, <0, 0, 0>, <2, 1, 4>) rotate <0, 0, 180> translate <30, 10, 0> } #include "camlight.inc" #declare centro_cena = <0.00, 0.00, 0.00>; #declare raio_cena = 60; #declare dir_camera = <0, 0.01, 10>; #declare dist_camera = 15.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)