// ====================================================================== // CORES E TEXTURAS #include "colors.inc" #include "eixos.inc" background{ color rgb < 0.75, 0.80, 0.85 > } // ====================================================================== // DESCRIÇÃO DA CENA #macro bolinha(cor) sphere { <0,0,0>, 0.1 pigment { color cor } } #end #macro quadro_anterior(fase) #local i = 0; #while(i < NQ-1) #if( (tempo[i] <= fase) & (tempo[i+1] >= fase) ) #local resp = i; #end #local i = i+1; #end resp #end #macro interpola(t0, v0, t1, v1, tt) #local ss = (tt-t0)/(t1-t0); #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); interpola(t0, v012, t1, v123, tt); #end #macro grafico(x0,y0,y1,y2,y3,x3,N,cor) #local i = (x3-x0)/(N-1); #local xx = x0; union{ #while(xx<=x3) #local yy = interpola4(x0,y0,y1,y2,y3,x3,xx); object{ bolinha(cor) translate } #local xx = xx + i; #end } #end #macro grafico3d(t0,y0,y1,y2,y3,t3,N,cor) #local i = (t3-t0)/(N-1); #local tt = t0; union{ #while(tt<=t3) #local yy = interpola4(t0,y0,y1,y2,y3,t3,tt); object{ bolinha(cor) translate yy } #local tt = tt + i; #end } #end #macro grafico4(y10,y11,y12,y21,y22,y31,y32,y41,y42,y43,N) union{ object{ grafico(0,y10,y11,y12,(y12+y21)/2,5,N,Blue) } object{ grafico(5,(y12+y21)/2,y21,y22,(y22+y31)/2,10,N,Red) } object{ grafico(10,(y22+y31)/2,y31,y32,(y32+y41)/2,15,N,Black) } object{ grafico(15,(y32+y41)/2,y41,y42,y43,20,N,Green) } } #end #macro grafico4_3d(tt,y10,y11,y12,y21,y22,y31,y32,y41,y42,y43,N) union{ object{ grafico3d(0,y10,y11,y12,(y12+y21)/2,tt/4,N,Blue) } object{ grafico3d(tt/4,(y12+y21)/2,y21,y22,(y22+y31)/2,tt/2,N,Red) } object{ grafico3d(tt/2,(y22+y31)/2,y31,y32,(y32+y41)/2,3*tt/4,N,Black) } object{ grafico3d(3*tt/4,(y32+y41)/2,y41,y42,y43,tt,N,Green) } } #end // // Aqui está a cena, finalmente: union{ object{ eixos(3.00) translate <-10,1,0>} object { grafico4(0,3,-2,7,8,5,2,-1,3,9,15) translate <-10,1,0>} object{ eixos(3.00) translate <0,-7,0>} object { grafico4_3d(30,<1,3,2>,<1,5,3>,<-1,-3,2>,<5,0,2>,<7,2,2>,<2,3,5>,<-1,-3,2>,<0,3,0>,<-5,0,2>,<-3,1,1>,20) translate <0,-7,0> } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 20.0; #declare dir_camera = <0,-0.01,1>; //< 14.00, 7.00, 4.00 >; #declare dist_camera = 50.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)