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 #include "eixos.inc" object { eixos(3.00) } 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 = < 0.00, 0.00, 0.00 >; #declare raio_cena = 15.0; #declare dir_camera = < 3.10, 0.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)