background{ color rgb <0.53, 0.81, 0.92> } #declare comp_toco_aresta = 0.5; #declare raio_aresta = 0.25; #declare tx_vert = texture { pigment { color rgb <1, 0.1, 0.1> } finish { diffuse 0.9 ambient 0.1 } } #declare tx_aresta = texture { pigment { color rgb <0.8, 0.9, 0.2> } finish { diffuse 0.7 ambient 0.1 metallic reflection 0.05 } } #macro vert_k1(xx, yy) #local vert = union { // vertice sphere { , 1 texture { tx_vert } } // arestas cylinder { , , raio_aresta texture { tx_aresta } } } vert #end #macro vert_k2(xx, yy) #local vert = union { // vertice union { sphere { , 1 } cone { , 1.0 , 0 } texture { tx_vert } } // arestas union { cylinder { , , raio_aresta } cylinder { , , raio_aresta } texture { tx_aresta } } } vert #end #macro vert_k3(xx, yy) #local vert = union { // vertice union { cone { , 1.0 , 0 } cone { , 1.0 , 0 } texture { tx_vert } } // arestas union { cylinder { , , raio_aresta } cylinder { , , raio_aresta } cylinder { , , raio_aresta } texture { tx_aresta } } } vert #end #macro vert_k4(xx, yy) #local vert = union { // vertice union { box { , } sphere { , 1.0 } texture { tx_vert } } // arestas union { cylinder { , , raio_aresta } cylinder { , , raio_aresta } cylinder { , , raio_aresta } cylinder { , , raio_aresta } texture { tx_aresta } } } vert #end #macro interpola1(tt, t0, v0, t1, v1) #local ss = (tt - t0)/(t1 - t0); #local vv = (1 - ss) * v0 + ss * v1; vv #end // interpolacao curva de bezier 3 grau #macro interpola3(tt, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(tt, ta, v0, tb, v1); #local v12 = interpola1(tt, ta, v1, tb, v2); #local v23 = interpola1(tt, ta, v2, tb, v3); #local v012 = interpola1(tt, ta, v01, tb, v12); #local v123 = interpola1(tt, ta, v12, tb, v23); #local v0123 = interpola1(tt, ta, v012, tb, v123); v0123 #end #macro interpola3_multi(tt, pini, n, total, p1, p2, pfin) #local ret = 0; #if (n = 0) #local ret = interpola3(tt, 0, 10, pini, p1[n], p2[n], p1[n + 1]); #else #if (n = total - 1) #local ret = interpola3(tt, 0, 10, p1[n], p1[n], p2[n], pfin); #else #local ret = interpola3(tt, 0, 10, p1[n - 1], p1[n], p2[n], p1[n + 1]); #end #end ret #end #local Pini = <0, 0, +0.5>; #local n = 3; #local P1 = array[n]; #local P1[0] = <1, 4, -0.5>; #local P1[1] = <1, -1, +0.5>; #local P1[2] = <2, 3, -0.5>; #local P2 = array[n]; #local P2[0] = <4, 4, +0.5>; #local P2[1] = <3, 1, -0.5>; #local P2[2] = <4.3, 3, +0.5>; #local Pfin = <2, 2, -0.5>; #include "bezpoly.inc" #local raio = 0.040; union { object{ bezpoly_multi(n, Pini, P1, P2, Pfin, 0.9*raio) } #local i = 0; #local j = 0; #while (j < n) #while (i <= 10) #local Pt = interpola3_multi(i, Pini, j, n, P1, P2, Pfin); sphere { Pt, raio texture{ tx_aresta } } // Faltava texture --Prof. #local i = i + 0.01; #end #local j = j + 1; #end } #include "eixos.inc" // object{ eixos(5) } #declare cmin = < -1.0,-1.5,-0.8 >; #declare cmax = < +5.0,+5.0,+0.8 >; box{ cmin-0.1*z, texture{ pigment{ color rgb <0.80,0.70,0.60> } finish {diffuse 0.7 ambient 0.3 } } } #include "camlight.inc" #declare centro_cena = (cmin + cmax)/2; #declare raio_cena = 0.5*vlength(cmin - cmax); #declare dir_camera = <30,20,50>; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)