// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_branco = texture{ pigment{ color rgb < 1, 1, 1 > } } #declare tx_fosca_marrom = texture{ pigment{ color rgb < 0.361, 0.2, 0.09 > } } #declare tx_olhos = texture{ pigment{ color rgb < 0.10, 0.62, 0.10 >} finish{ diffuse 0.9 ambient 0.5 } } //Constantes #declare N_Esferas = 500; //roleta para numeros aleatorios #declare roleta = seed(123); // ====================================================================== // DESCRIÇÃO DA CENA // Funcoes: #macro interpola (f0, v0, f1, v1, f) #local ss = (f-f0)/(f1-f0); #local rr = 1-ss; (rr*v0 + ss*v1) #end #macro interpola4 (t0, v0, v1, v2, v3, t1, tt) #local v01 = interpola(t0, v0, t1, v1, tt); #local v12 = interpola(t0, v1, t1, v2, tt); #local v23 = interpola(t0, v2, t1, v3, tt); #local v012 = interpola(t0, v01, t1, v12, tt); #local v123 = interpola(t0, v12, t1, v23, tt); #local v0123 = interpola(t0, v012, t1, v123, tt); v0123 #end /* //Gera N graficos #macro geraPontosMedios () #local i = 0; #while (i<=N_Graficos) #declare pontosMediosX[i] = i*10/N_Graficos; #declare pontosMediosY[i] = rand(roleta)*10; #local i = i+1; #end #end #macro geraGraficos() #local j = 0; union{ #while (j, 0.1 } texture {tx_branco} } #local j = j+1; #end object { sphere{ , 0.1 } texture {tx_branco} } } #end */ //Grafico #macro grafico (x0, y0, y1, y2, y3, x3, N) #local intervalo = (x3-x0)/N; #local var = x0; union { #while (var < x3) #local yt = interpola4 (x0, y0, y1, y2, y3, x3, var); object { sphere{ <0, 0, var>, 0.1 } translate yt } #local var = var + intervalo; #end } #end #include "eixos.inc" // Aqui está a cena, finalmente: union { object { eixos (10)} #local y0a = ; #local y1a = ; #local y2a = ; #local y1b = ; #local y2b = ; #local y1c = ; #local y2c = ; #local y1d = ; #local y2d = ; #local y3d = ; object {grafico(0, y0a, y1a, y2a, (y2a+y1b)/2, 2, N_Esferas) texture {tx_fosca_marrom}} object {grafico(2, (y2a+y1b)/2, y1b, y2b, (y2b+y1c)/2, 4, N_Esferas) texture {tx_olhos}} object {grafico(4, (y2b+y1c)/2, y1c, y2c, (y2c+y1d)/2, 6, N_Esferas) texture {tx_fosca_marrom}} object {grafico(6, (y2c+y1d)/2, y1d, y2d, y3d, 8, N_Esferas) texture {tx_olhos}} } #include "camlight.inc" #declare centro_cena = < 5.00, 5.00, 5.00 >; #declare raio_cena = 15.0; #declare dir_camera = < 0.001, 1000.001, 1000.00 >; #declare dist_camera = 160.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , y, intens_luz)