// Last edited on 2019-07-17 06:53:57 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) #local ii = 1; #local p[M-1][2] = p[0][0] - vv[0]; #local p[0][1] = p[0][0] + vv[0]; #local p[M-1][3] = p[0][0]; #while (ii < M) #local p[ii-1][3] = p[ii][0]; #local p[ii-1][2] = p[ii][0] - vv[ii]; #local p[ii][1] = p[ii][0] + vv[ii]; #local ii = ii+1; #end p #end #macro suavizaMatriz(P, M) #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); PP #end #macro interpolaMatriz(P,Q,M,c0,c1,cc,R) #local ii = 0; #while(ii < M) #local kk = 0; #while(kk < 4) #declare R[ii][kk] = interpolaLin(c0,P[ii][kk],c1,Q[ii][kk],cc); #local kk = kk + 1; #end #local ii = ii + 1; #end #end #declare p = array[5][4]; #declare q = array[5][4]; #declare R = array[5][4]; #declare p[0][0] = <0,0,0>; #declare p[1][0] = <400,0,0>; #declare p[2][0] = <400,400,0>; #declare p[3][0] = <0,400,0>; #declare p[4][0] = <-200,0,100>; #declare q[0][0] = <57,150,200>; #declare q[1][0] = <-300,30,-200>; #declare q[2][0] = <-500,400,200>; #declare q[3][0] = <-200,-400,0>; #declare q[4][0] = <200,0,-100>; #declare p = suavizaMatriz(p,5); #declare q = suavizaMatriz(q,5); #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 animacao(P, Q, NPQ, NA, NB) #local cc = 0; #local ii = 1/NA; #while (cc < 1) interpolaMatriz(P,Q,NPQ,0,1,cc,R) object{ no_bezier(R,NB,NPQ) translate 3500*cc*y } #local cc = cc + ii; #end #end animacao(p,q,5,5,1000) #include "camlight.inc" #declare centro_cena = < 0.00, 1700.00, 1.00 >; #declare raio_cena = 2000; #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)