#include "eixos.inc" #include "transforms.inc" // Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.8, 0.8, 0.8 > } #declare tx_vertice = texture{ pigment{ color rgb < 0.585, 0.292, 0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_tubo = texture{ pigment{ color rgb < 0.01, 1, 0.12 > } finish{ diffuse 0.9 ambient 0.1 } } #declare vertice_1 = union { sphere { <0, 0, 0>, 1 } cylinder { <0, 2, 0>, <0, -2, 0>, 0.5 } texture { tx_vertice } } #macro vertice_2(cx, cy, cz) box { , // near lower left corner, far upper right corner texture { tx_vertice } } #end #macro vertice_3(cx, cy, cz) union { polygon { 5, , , , , } polygon { 4, , , , } polygon { 4, , , , } polygon { 4, , , , } polygon { 4, , , , } texture { tx_vertice } } #end #declare vertice_4 = cylinder { <0,0,-0.5>, <0, 0, 0.5>, 1 // center of one end, center of other end, radius texture { tx_vertice } } #macro interpola1(ti, t0, v0, t1, v1) #local ss = (ti-t0)/(t1-t0); #local vv = (1-ss)*v0 + ss*v1; vv #end #macro interpola3(ti, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(ti, ta, v0, tb, v1); #local v12 = interpola1(ti, ta, v1, tb, v2); #local v23 = interpola1(ti, ta, v2, tb, v3); #local v012 = interpola1(ti, ta, v01, tb, v12); #local v123 = interpola1(ti, ta, v12, tb, v23); #local v0123 = interpola1(ti, ta, v012, tb, v123); v0123 #end #macro interpola3_multi(ti, pn, n, p1, p2, pm) #local k = int(ti); #local q0 = pn; #if (k > 0) #local q0 = (p2[k-1] + p1[k])/2; #end #local q3 = (p2[k] + pm)/2; #if (k < n-1) #local q3 = (p2[k] + p1[k+1])/2; #end #local q1 = p1[k]; #local q2 = p2[k]; #local pt = interpola3(ti, k, k + 1, q0, q1, q2, q3); pt #end #macro teste_interpola3_multi(n, p0, p1, p2, p3, qtde, raio) #local k = 0; #while(k < n) #local centro = interpola3_multi(k, pin, n, p1, p2, p3); object { sphere{ centro, raio texture { tx_tubo } } } #local k = k + n / qtde; #end #end #declare pin = <0, 2, 0>; #declare pfi = <15, 15, 0>; #declare p1 = array[3] {<3, 4, 0>, <11, 9, 0>, <13, 12, 0>}; #declare p2 = array[3] {<8, 2, 0>, <14, 10, 0>, <16, 18, 0>}; #declare n = 3; union{ teste_interpola3_multi(n, pin, p1, p2, pfi, 500, 0.5) object {vertice_1} object {vertice_1 translate <15, 17, 0> } } // teste_interpola_1(<0, 2, 0> <-15, 0, 20>, <-9, 0, 3>, <15, 17, 15>, 230, 0.2) eixos(20) #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 30.0; #declare dir_camera = < 1, 1.00, 2 >; #declare dist_camera = 200*raio_cena; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)