// CORES E TEXTURAS #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 } } background{ color rgb < 0.75, 0.80, 0.85 > } // DESCRIÇÃO DA CENA #macro CriaCurva(raio) #declare curva = spline { natural_spline -0.25, < 0.0,-5.0,-1.0>, 0.00, < 0.0, 0.0, 0.0>, 0.25, < 0.0, 5.0, 4.0>, 0.50, < 1.5, 6.0,12.0>, 0.75, < 8.0, 4.0,18.5>, 1.00, <15.0, 5.0,20.0>, 1.25, <20.0, 5.0,19.4> } #end #macro InterpolacaoLinear(x0, y0, x1, y1, tt) #local delta = x1 - x0; #local r = (tt - x0)/delta; #local s = 1 - r; #local vv = s*y0 + r*y1; vv #end #macro arcobevier(t0, t1, A, B, C ,D, tt) #local AB = InterpolacaoLinear(t0, A.y, t1, B.y, tt); #local BC = InterpolacaoLinear(t0, B.y, t1, C.y, tt); #local CD = InterpolacaoLinear(t0, C.y, t1, D.y, tt); #local ABC = InterpolacaoLinear(t0, AB, t1, BC, tt); #local BCD = InterpolacaoLinear(t0, BC, t1, CD, tt); #local ABCD = InterpolacaoLinear(t0, ABC, t1, BCD, tt); ABCD #end #macro suavizaZ(P, N, i, vv) #local j = mod(i+i, N); #declare P[i][2] = P[i][3] - vv; #declare P[j][2] = P[j][0] + vv; #end #macro suavizaX(P, N, i) #local j = mod(i+i, N); #local vv = (P[j][i] - P[i][2])/2; suavizaZ(P, N, i, vv) #end #macro palito(R, A, B, C, D, t0, t1, uu) #local palto = union { #local tt = t0.x; #while (tt < t1.x) sphere{ <0,0,0>, R pigment { color rgb<1,0.3,0>} translate } #local tt = tt + uu; #end } palto #end #macro CriaNo(n_voltas, raio_corda, espacamento_entre_bolas) #declare uu = 0.07; #declare bolas = 10; #declare n_arcos = 3; #declare n_curvas = 4; #declare arcos = array[n_arcos][n_curvas]; #declare arcos[0][0] = <1, 3, 5>; #declare arcos[0][1] = <1, 5, 0>; #declare arcos[0][2] = <4, 5, 5>; #declare arcos[0][3] = <4, 3, 0>; #declare arcos[1][0] = <4, 3, 5>; #declare arcos[1][1] = <4, 0, 0>; #declare arcos[1][2] = <10, 0, 5>; #declare arcos[1][3] = <10, 3, 0>; #declare arcos[2][0] = <15, 3, 0>; #declare arcos[2][1] = <10, 20, 5>; #declare arcos[2][2] = <15, 20, 0>; #declare arcos[2][3] = <10, 3, 5>; suavizaX(arcos, n_arcos, 0); suavizaX(arcos, n_arcos, 1); suavizaX(arcos, n_arcos, 2); union { #declare i = 0; #while (i < n_arcos) object { palito(raio_corda, arcos[i][0], arcos[i][1], arcos[i][2], arcos[i][3], arcos[i][0], arcos[i][3], uu) } #declare i = i + 1; #end } #end CriaNo(5, 0.7, 1) #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 30.0; #declare dir_camera = < 10.00, 10.00, 10.00 >; #declare dist_camera = 2*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , y, intens_luz)