//Lucas Felix 136625 // ====================================================================== background{ color rgb < 0.15, 0.80, 0.55 > } #declare Yellow = rgb<255, 255, 0>; #declare Black = rgb < 0.4, 0.2, 0.8 >; #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.10, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare esfera = sphere { < (1*clock), (1*clock), (1*clock)>, (2*clock) // Near lower left corner texture{ tx_plastico } } // ====================================================================== // DESCRIÇÃO DA CENA #include "eixos.inc" object{ eixos(3.00) } #declare N=3; //matriz com os pontos #declare nk = 3; #declare P = array[nk][N][4]; //Quadro 1 //Arco 1 #declare P[0][0][0] = <0,6,0>; #declare P[0][0][1] = <0.6,7.5,0>; #declare P[0][0][2] = <3.2,7.5,0>; #declare P[0][0][3] = <4,6,0>; //Arco 2 #declare P[0][1][0] = <4,6,0>; #declare P[0][1][1] = <6,3,0>; #declare P[0][1][2] = <13,3,0>; #declare P[0][1][3] = <14,6,0>; //Arco 3 #declare P[0][2][0] = <14,6,0>; #declare P[0][2][1] = <15,7.5,0>; #declare P[0][2][2] = <17.5,7.5,0>; #declare P[0][2][3] = <18,6,0>; //Quadro 2 //Arco 1 #declare P[1][0][0] = <0,6,0>; #declare P[1][0][1] = <0.6,7.5,0>; #declare P[1][0][2] = <3.2,7.5,0>; #declare P[1][0][3] = <4,6,0>; //Arco 2 #declare P[1][1][0] = <4,6,0>; #declare P[1][1][1] = <6,3,0>; #declare P[1][1][2] = <13,3,0>; #declare P[1][1][3] = <14,6,0>; //Arco 3 #declare P[1][2][0] = <14,6,0>; #declare P[1][2][1] = <15,7.5,0>; #declare P[1][2][2] = <17.5,7.5,0>; #declare P[1][2][3] = <18,6,0>; //Quadro 3 //Arco 1 #declare P[2][0][0] = <0,6,0>; #declare P[2][0][1] = <0.6,7.5,0>; #declare P[2][0][2] = <3.2,7.5,0>; #declare P[2][0][3] = <4,6,0>; //Arco 2 #declare P[2][1][0] = <4,6,0>; #declare P[2][1][1] = <6,3,0>; #declare P[2][1][2] = <13,3,0>; #declare P[2][1][3] = <14,6,0>; //Arco 3 #declare P[2][2][0] = <14,6,0>; #declare P[2][2][1] = <15,7.5,0>; #declare P[2][2][2] = <17.5,7.5,0>; #declare P[2][2][3] = <18,6,0>; //Definição dos tempos tk #declare tk = array[nk] #declare tk[0] = 0.0000; #declare tk[1] = 0.5000; #declare tk[2] = 1.0000; #macro busca_tempo(clk, nk, tk) //devolve k tal que //t.k[k] =< clk=< tk[k+1] #for(k, 0, nk-2) #if((clk <= tk[k+1]) & (tk[k] <= clk)) #local resultado = k; #end #end resultado #end #macro interpola(to, vo, t1, v1, tt ) #local r = (tt-to)/(t1-to); #local s = 1-r; #local vv= s*vo+r*v1; vv #end #macro arcobezier(to, t1, a, b, c, d, tt ) #local ab = interpola(to, a, t1, b, tt ); #local bc = interpola(to, b, t1, c, tt ); #local cd = interpola(to, c, t1, d, tt ); #local abc = interpola(to, ab, t1, bc, tt ); #local bcd = interpola(to, bc, t1, cd, tt ); #local abcd = interpola(to, abc, t1, bcd, tt ); abcd #end #macro arco(a0, a1, a2, a3, t0, t1, n) union{ #declare passo = 1/n; #declare j = t0; #while (j <= t1) object { esfera translate arcobezier(t0,t1, a0, a1, a2, a3, j)} #declare j=j+passo; #end } #end #macro suaviza(P,i,N) #local j = mod(i+1, N); #local vv = (P[j][1]-P[i][2])/2; #declare P[i][2]= P[i][3]-vv; #declare P[j][1]= P[j][0]+vv; #end #macro noh(P, N, M) //N = Numero de arcos; M = Numero de bolinhas por arco union{ #local i = 0; #declare lado = M/N; #while(i < N ) object {arco (P[i][0], P[i][1], P[i][2], P[i][3], (i*lado), (i+1)*lado, M) } #local i = i+1; #end } #end #macro interpolaMatriz(PP, q0, q1, N, CO, CI, cc, R) #local i=0; #while (i; #end #end #macro imatrizes(P, Q, N) union{ #for(cc, 0, 1, 0.2) interpolaMatriz(P, Q, N, 0, 1, cc, R) object{noh(R, N, 20)} #end } #end // Animação da esferinha inchando //object{imatrizes(P,Q,3)} //union{ // object{esfera} // } #declare quadro = busca_tempo(clock, nk, tk); union{ interpolaMatriz(P, quadro, quadro+1, N, tk[quadro], tk[quadro+1], clock, R) object{noh(R, N, 20)} } //#macro noh(P, N, M) #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 12.0; #declare dir_camera = < 45.00, 20.00, 10.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)