// Last edited on 2019-07-17 09:50:02 by stolfilocal // Processed by remove-cam-lights background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #macro interpolaLin (t0, v0, t1, v1, tt) #local r = (tt-t0)/(t1-t0); #local s = 1-r; #local vv = s*v0 + r*v1; vv #end #macro arcobezier (t0, t1, A, B, C, D, tt) #local AB = interpolaLin(t0,A,t1,B,tt); #local BC = interpolaLin(t0,B,t1,C,tt); #local CD = interpolaLin(t0,C,t1,D,tt); #local ABC = interpolaLin(t0,AB,t1,BC,tt); #local BCD = interpolaLin(t0,BC,t1,CD,tt); #local ABCD = interpolaLin(t0,ABC,t1,BCD,tt); ABCD #end #macro suaviza(p, vv, M, Q) #local jj = 0; #while (jj < Q) #local ii = 1; #local p[jj][M-1][2] = p[jj][0][0] - vv[0]; #local p[jj][0][1] = p[jj][0][0] + vv[0]; #local p[jj][M-1][3] = p[jj][0][0]; #while (ii < M) #local p[jj][ii-1][3] = p[jj][ii][0]; #local p[jj][ii-1][2] = p[jj][ii][0] - vv[ii]; #local p[jj][ii][1] = p[jj][ii][0] + vv[ii]; #local ii = ii+1; #end #local jj = jj + 1; #end p #end #macro suavizaMatriz(P, M, Q) #local vv = array[M]; #local vv[0] = <100,200,0>; #local vv[1] = <100,200,0>; #local vv[2] = <100,200,0>; #local vv[3] = <-150,100,0>; #local vv[4] = <-100,200,50>; #declare PP = suaviza(P,vv,M, Q); PP #end #macro interpolaMatriz(P,k0,k1,M,c0,c1,cc,R) #local ii = 0; #while(ii < M) #local kk = 0; #while(kk < 4) #declare R[ii][kk] = interpolaLin(c0,P[k0][ii][kk],c1,P[k1][ii][kk],cc); #local kk = kk + 1; #end #local ii = ii + 1; #end #end #declare NK = 6; #declare NA = 5; #declare p = array[NK][NA][4]; #declare R = array[NA][4]; #declare tk = array[6]; #declare iii = 0; #while (iii < 5.1) #declare tk[iii] = iii; #declare iii = iii + 1/5; #end #declare p[0][0][0] = <0,0,0>; #declare p[0][1][0] = <400,0,0>; #declare p[0][2][0] = <400,400,0>; #declare p[0][3][0] = <0,400,0>; #declare p[0][4][0] = <-200,0,100>; #declare p[1][0][0] = <200,250,100>; #declare p[1][1][0] = <100,-050,100>; #declare p[1][2][0] = <300,-250,-100>; #declare p[1][3][0] = <400,-350,-300>; #declare p[1][4][0] = <200,-150,-100>; #declare p[2][0][0] = <157,137,-057>; #declare p[2][1][0] = <320,250,100>; #declare p[2][2][0] = <-100,100,200>; #declare p[2][3][0] = <-233,-100,320>; #declare p[2][4][0] = <180,215,160>; #declare p[3][0][0] = <57,150,200>; #declare p[3][1][0] = <-300,30,-200>; #declare p[3][2][0] = <-500,400,200>; #declare p[3][3][0] = <-200,-400,0>; #declare p[3][4][0] = <200,0,-100>; #declare p[4][0][0] = <-150,-200,-500>; #declare p[4][1][0] = <-250,-300,-600>; #declare p[4][2][0] = <-420,-200,-300>; #declare p[4][3][0] = <-220,-150,-150>; #declare p[4][4][0] = <-057,-057,-057>; #declare p[5][0][0] = <350,450,550>; #declare p[5][1][0] = <680,220,223>; #declare p[5][2][0] = <520,110,115>; #declare p[5][3][0] = <420,-200,250>; #declare p[5][4][0] = <220,150,100>; #declare p = suavizaMatriz(p,NA,NK); #macro no_bezier (P, N, M) #local ii = 1/N; #local k = 0; union{ #while (k < 5) #local tt=0; #while (tt < 1) object {sphere {arcobezier(0.0, 1.0, P[k][0], P[k][1], P[k][2], P[k][3],tt), 20.00 texture{tx_fosca}}} #local tt = tt + ii; #end #local k = k+1; #end } #end #macro buscaTempo(clk,NK,tk) #local k = 0; #local resultado = 0; #while (k < NK-1) #if(clk >= tk[k] & clk < tk[k+1]) #local resultado = k; #end #local k = k + 1; #end resultado #end #macro testeQuadro(P, k, NPQ, NA, NB, cc) interpolaMatriz(P,k,k+1,NPQ,tk[k],tk[k+1],cc,R) no_bezier(R,NB,NPQ) #end #macro testeAnimacao () sphere{<1000*clock,1000*clock,1000*clock>, 20 texture{tx_fosca}} #end #declare k = buscaTempo(clock, NK, tk); testeQuadro(p,k,5,5,1000,clock) #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 1200; #declare dir_camera = < 10.00, 10.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)