background{ color rgb < 0, 0.3, 0.6 > } // ====================================================================== // CORES E TEXTURAS #declare tx_plastico_azul = texture { pigment { color rgb < 0.05, 0.40, 0.50 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_plastico_branco = texture { pigment { color rgb < 1, 1, 1 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_plastico_vermelho = texture { pigment { color rgb < 0.9, 0.1, 0.1 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // ====================================================================== // DESCRIÇÃO DOS VÉRTICES #declare ver_2 = union { union { sphere { < 0, 0, 0>, 2 } cylinder { <3, 0, 0>, <-3, 0, 0>, 1 } texture { tx_plastico_azul } } union { sphere { <3, 0, 0>, 0.25 } sphere { <-3, 0, 0>, 0.25 } texture { tx_plastico_branco } } } #declare ver_3 = union { union { cylinder { <0, 0, -0.75>, <0, 0, 0.75>, 2 } cone { <0, 0, 0.75>, 2.0 <0, 0, 1.75>, 0 } texture { tx_plastico_azul } } union { sphere { <2, 0, 0>, 0.25 } sphere { <2, 0, 0>, 0.25 rotate <0, 0, 120> } sphere { <2, 0, 0>, 0.25 rotate <0, 0, 240> } texture { tx_plastico_branco } } } #declare ver_4 = union { union { box { <-1, -1, -1>, <1, 1, 1> } box { <-0.5, -0.5, 1>, <0.5, 0.5, 2> rotate <0, 0, 45> } texture { tx_plastico_azul } } union { sphere { <1, 0, 0>, 0.25 } sphere { <0, 1, 0>, 0.25 } sphere { <-1, 0, 0>, 0.25 } sphere { <0, -1, 0>, 0.25 } texture { tx_plastico_branco } } } // ====================================================================== // INTERPOLAÇÃO #macro interpola1 (T, T0, V0, T1, V1) #local ss = (T - T0) / (T1 - T0); #local vv = (1 - ss) * V0 + ss * V1; vv #end #macro interpola3 (T, T0, T1, V0, V1, V2, V3) #local v01 = interpola1(T, T0, V0, T1, V1); #local v12 = interpola1(T, T0, V1, T1, V2); #local v23 = interpola1(T, T0, V2, T1, V3); #local v012 = interpola1(T, T0, v01, T1, v12); #local v123 = interpola1(T, T0, v12, T1, v23); #local v0123 = interpola1(T, T0, v012, T1, v123); v0123 #end #macro interpola1_teste (P0, P1, N, R) union { #local i = 0; #while (i < N) #local centro = interpola1 (i, 0, P0, N, P1); sphere { centro, R } #local i = i + 1; #end } #end #macro interpola3_teste (P0, P1, P2, P3, N, R) union { #local i = 0; #while (i < N) #local centro = interpola3 (i, 0, N, P0, P1, P2, P3); sphere { centro, R } #local i = i + 1; #end } #end // ====================================================================== // CONSTRUINDO #include "eixos.inc" // object{ eixos(15) } #local pos_2 = <5, 2, 7>; #local pos_4 = <1, 6, 0>; union { object { ver_2 rotate <0, 0, 90> translate pos_2 } object { ver_4 translate pos_4 } object { ver_3 } object { interpola3_teste(pos_2 + <0,3,0>, <5, 4, 1>, <10, 5, -1>, pos_4 + <1,0,0>, 400, 0.1) texture {tx_plastico_vermelho} } } #declare cmin = < -3,-3,-3 >; #declare cmax = < +7,+9,+10 >; box{ cmin-<2,2,0> +<2,2,0.01> texture{ pigment{ color rgb 0.9*<1,1,1> } finish {diffuse 0.7 ambient 0.3 } } } #include "camlight.inc" #declare centro_cena = (cmin + cmax)/2; #declare raio_cena = 0.55*vlength(cmin - cmax); #declare dir_camera = < 3.00, 5.00, 4.00 >; #declare dist_camera = 5 * raio_cena; #declare intens_luz = 1.2; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)