// Last edited on 2019-07-17 09:33:50 by stolfilocal // Processed by remove-cam-lights background{ color rgb < 0.8, 0.7, 0.5 > } #declare tx_corda = texture{ pigment{ color rgb < 0.3, 0.2, 0.2 > } finish{ diffuse 0.9 ambient 0.1 } } #include "eixos.inc" #include "pontos.inc" #macro interpola_linear(T,T0,T1,P0,P1) (P0+(T-T0)/(T1-T0)*(P1-P0)) #end #macro interpola_3d(T, T0, T1, P0, P00, P1, P11) (P0*pow((1-(T0+T/(T1-T0))),3) + P00*3*(T0+T/(T1-T0))*pow((1-(T0+T/(T1-T0))),2) + 3*P11*pow((T0+T/(T1-T0)),2)*(1-(T0+T/(T1-T0))) + pow((T0+T/(T1-T0)),3)*P1) #end #macro arco(A0, A1, A2, A3, T0, T1) union{ #local T = T0; #while (T<=T1) object{ sphere { interpola_3d(T,T0,T1,A0, A1, A3, A2), 0.2 texture {tx_corda}}} #local T = T+1; #end } #end #macro make_no(P, N, M) union{ #local I = 0; #while (I < N) arco(P[I][0],P[I][1],P[I][2],P[I][3],0,M) #local I = I + 1; #end } #end #macro interpola_linear_matriz(P,Q,N,C0,C1,CC) #local R = array[N][4]; #for (I,0,N-1,1) #for (J,0,3,1) #local R[I][J] = <0,0,0>; #end #end #local I = 0; #while (I < N) #local K = 0; #while (K < 4) #local R[I][K] = interpola_linear(CC,C0,C1,P[I][K],Q[I][K]); #local K = K + 1; #end #local I = I + 1; #end R #end #macro get_no (I, N, P) #local R = array[N][4]; #for (J, 0, N-1,1) #for (K, 0, 3, 1) #local R[J][K] = P[I][J][K]; #end #end R #end #macro busca_tempo (clk, NK, TK) #local K = 0; #local find = 0; #while ((K <= NK) & (find = 0)) #if ((TK[K] <= clk) & (TK[K+1] >= clk)) #local find = 1; #else #local K = K + 1; #end #end K #end union{ #declare P = pontos(); #declare TK = array[6]; #declare TK[0] = 0; #declare TK[1] = 0.2; #declare TK[2] = 0.4; #declare TK[3] = 0.6; #declare TK[4] = 0.8; #declare TK[5] = 1; #declare I = busca_tempo (clock, 6, TK); #declare P1 = get_no(I, 3, P); #declare P2 = get_no(I+1, 3, P); #local R = interpola_linear_matriz(P1,P2,3,TK[I],TK[I+1],clock); make_no(R,3,1000) } #include "camlight.inc" #declare centro_cena = < -4.00, 5.00, 0.00 >; #declare raio_cena = 12; #declare dir_camera = < 1, 1, 0 >; #declare dist_camera = 4*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)