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.2, 0.2, 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 bezier(v0, v1, v2, v3) // #local a = 0; // #local b = 10; // #local cur_step = a; // union { // #while (cur_step <= b) // #local p = interpola3(cur_step, a, b, v0, v1, v2, v3); // sphere { p, 0.05 } // #local cur_step = cur_step + 0.01; // #end // } // #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 #include "eixos.inc" object { eixos(3.00) } #local Pini = <0, 0, 0>; #local n = 3; #local P1 = array[n]; #local P1[0] = <1, 4, 0>; #local P1[1] = <1, -1, 0>; #local P1[2] = <3.7, 4, 0>; #local P2 = array[n]; #local P2[0] = <2, 4, 0>; #local P2[1] = <3, 1, 0>; #local P2[2] = <4.3, 4, 0>; #local Pfin = <2, 2, 0>; union { #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, 0.025 } #local i = i + 0.01; #end #local j = j + 1; #end } // object { bezier(<0, 0, 0>, <1, 2, 0>, <2, -8, 0>, <3, 3, 0>) } // object { vert_k1(0, -3) } // object { vert_k2(3, -3) } // object { vert_k3(7, -3) } // object { vert_k4(-3, -3) } #include "camlight.inc" #declare centro_cena = < 1.5, 1.5, 0.00 >; #declare raio_cena = 5.0; #declare dir_camera = < 0.00, -0.01, 0.20 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)