background{ color rgb < 0.75, 0.80, 0.85 > } #include "eixos.inc" //------------------------------------Macros #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, t3, tt) #local v01 = interpola(t0, v0, t3, v1, tt); #local v12 = interpola(t0, v1, t3, v2, tt); #local v23 = interpola(t0, v2, t3, v3, tt); #local v012 = interpola(t0, v01, t3, v12, tt); #local v123 = interpola(t0, v12, t3, v23, tt); #local v0123 = interpola(t0, v012, t3, v123, tt); v0123; #end #macro grafico(x0, y0, y1, y2, y3, x3, N) union { #local xx = x0; #while(xx <= x3) #local yy = interpola4(x0, y0, y1, y2, y3, x3, xx); sphere{ 0.15} #local xx = xx + ((x3-x0)/N); #end } #end #macro grafico4(x0, y0, y11, y12, y21, y22, y31, y32, y41, y42, yf, x3, N) union{ #local xx0 = x0; #local xx3 = xx0 + (x3-x0)/4; #local yy = (y12+y21)/2; object{grafico(xx0, y0, y11, y12, yy, xx3, N/4)} #local xx0 = xx3; #local xx3 = xx3 + ((x3-x0)/4); #local yi = yy; #local yy = (y22+y31)/2; object{grafico(xx0, yi, y21, y22, yy, xx3, N/4)} #local xx0 = xx3; #local xx3 = xx3 + ((x3-x0)/4); #local yi = yy; #local yy = (y32+y41)/2; object{grafico(xx0, yi, y31, y32, yy, xx3, N/4)} #local xx0 = xx3; #local xx3 = xx3 + ((x3-x0)/4); #local yi = yy; object{grafico(xx0, yi, y41, y42, yf, xx3, N/4)} } #end //------------------------------------Descrição object{grafico4(0, 1, -5, 2, -3, 7, -8, 3, -6, 4, -9, 4, 100)} //Camera #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 10.0; #declare dir_camera = < 1.00, 0.00, 20.00 >; #declare dist_camera = 16.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)