// 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.75, 0.80, 0.85 > } #declare tx_tanque_grande = texture{ pigment{ color rgb < 0.41, 0.41, 0.41 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_tanque_pequeno = texture{ pigment{ color rgb < 0.50, 0.50, 0.50 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_tanque_medio = texture{ pigment{ color rgb < 0.66, 0.66, 0.66 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_cano = texture{ pigment{ color rgb < 1, 1, 1 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_black = texture{ pigment{ color rgb < 1.00, 0.00, 0.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // ====================================================================== // DESCRI��O DA CENA #declare raioBaseTanqueGrande = 5; #declare raioSuperiorTanqueGrande = 2; #declare raioBaseTanqueMedio = 4.5; #declare raioBaseTanquePequeno = 3; #declare raioSuperiorTanquePqueno = 1; // Partes do peao: #declare baseGrande = cylinder{ < 0, 0, 0.0 >, < 0, 0, 14.0 >, raioBaseTanqueGrande texture{ tx_tanque_grande } } #declare baseMedio = cylinder{ < 0, 0, 0.0 >, < 0, 0, 5.0 >, raioBaseTanqueMedio texture{ tx_tanque_medio } } #declare basePequeno = cylinder{ < 0, 0, 0.0 >, < 0, 0, 12.0 >, raioBaseTanquePequeno texture{ tx_tanque_pequeno } } #declare superiorGrande = cone{ < 0, 0, 14 >, raioBaseTanqueGrande, < 0, 0, 18 >, raioSuperiorTanqueGrande texture{ tx_tanque_grande} } #declare superiorMedio = sphere{ < 0, 0.0, 5 >, 4.3 texture{ tx_tanque_medio } } #declare superiorPequeno = cone{ < 0, 0, 12.0 >, raioBaseTanquePequeno, < 0, 0, 16.5 >, raioSuperiorTanquePqueno texture{ tx_tanque_pequeno} } #declare divisasPequeno = cylinder{ < 0, 0, 0.0 >, < 0, 0, 1.0 >, 3.3 texture{ tx_tanque_pequeno } } #declare cano1 = cylinder{ < 0, 0, 0.0 >, < 5.2, 0, 0.0 >, 0.5 texture{ tx_cano } } #declare cano2 = cylinder{ < 0, 0, 0.0 >, < -5.2, 0, 0.0 >, 0.5 texture{ tx_cano } } #declare cano3 = cylinder{ < 0, 0, 0.0 >, < 0, 5.2, 0.0 >, 0.5 texture{ tx_cano } } #declare cano4 = cylinder{ < 0, 0, 0.0 >, < 0, -5.2, 0.0 >, 0.5 texture{ tx_cano } } #macro interpola1(t_curr, t0, v0, t1, v1) #local ss = (t_curr - t0)/(t1 - t0); #local vv = (1 - ss)*v0 + ss * v1; vv #end #macro testa_interpola_1(p0, p1, n, raio) union{ #declare k = 0; #while (k < n) #local centro = interpola1(k, 2, p0, 4, p1); object { sphere{ centro, raio texture{ tx_black } } } #declare k = k + 1; #end } #end #macro interpola3(t_curr, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(t_curr, ta, v0, tb, v1); #local v12 = interpola1(t_curr, ta, v1, tb, v2); #local v23 = interpola1(t_curr, ta, v2, tb, v3); #local v012 = interpola1(t_curr, ta, v01, tb, v12); #local v123 = interpola1(t_curr, ta, v12, tb, v23); #local v0123 = interpola1(t_curr, ta, v012, tb, v123); v0123 #end #macro testa_interpola_3(p0, p1, p2, p3, n, raio) union{ #declare k = 0; #while (k < n) #local centro = interpola3(k, 0, n, p0, p1, p2, p3); object { sphere{ centro, raio texture{ tx_black } } } #declare k = k + 1; #end } #end #macro interpola_3_multi(t0, pn, n, p1, p2, pf) #declare k = int(t0); #local q0 = pn; #local qn = pf; #if (k > 0) #local q0 = (p2[k - 1] + p1[k]) / 2; #end #if (k < n - 1) #local qn = (p2[k] + p1[k + 1]) / 2; #end #local pt = interpola3(t0, k, k + 1, q0, p1[k], p2[k], qn); pt #end #macro gera_grafo(nv, ne, org, dst, D, na, nb) union { #declare deg = array[nv]; #declare pos = array[nv]; #declare roleta1 = seed(123131); #declare roleta2 = seed(213414); #declare roleta3 = seed(432142); #local num_v = 0; #local index = 0; #for (i, 0, nv - 1) #declare deg[i] = 0; #end #while (num_v < nv) #declare xx = int(D*rand(roleta1)); #declare yy = int(D*rand(roleta2)); #declare zz = int(D*rand(roleta3)); #declare pos[num_v] = ; #local num_v = num_v + 1; #end #while (index < ne) #local v_out = org[index]; #local v_in = dst[index]; #local grau_out = deg[v_out]; #local grau_in = deg[v_in]; #if (grau_out < 4 & grau_in < 4) #declare deg[v_out] = deg[v_out] + 1; #declare deg[v_in] = deg[v_in] + 1; #end #local index = index + 1; #end #for (vertice, 0, nv - 1) #if (deg[vertice] = 0) object { vert_grau0(pos[vertice]) } #end #if (deg[vertice] = 1) object { vert_grau1(pos[vertice]) } #end #if (deg[vertice] = 2) object { vert_grau2(pos[vertice]) } #end #if (deg[vertice] = 3) object { vert_grau3(pos[vertice]) } #end #if (deg[vertice] = 4) object { vert_grau4(pos[vertice]) } #end #end } #end #macro vert_grau0(p) union { object { sphere { p, 2 texture{ tx_tanque_medio } } } } #end #macro vert_grau1(p) #local vt = union { object { sphere { p, 2 texture{ tx_tanque_medio } } } object { cylinder{ p + <2, 0, 0>, p + <3, 0, 0>, 0.5 texture{ tx_cano } } } } vt #end #macro base_grau1(p) #local base = p + <2, 0, 0>; base #end #macro ponta_grau1(p) #local ponta = p + <3, 0, 0>; ponta #end #macro vert_grau2(p) union { object { sphere { p, 2 texture{ tx_tanque_medio } } } object { cylinder{ p + <2, 0, 0>, p + <3, 0, 0>, 0.5 texture{ tx_cano } } } object { cylinder{ p + <0, 2, 0>, p + <0, 3, 0>, 0.5 texture{ tx_cano } } } } #end #macro base_grau2(p) #local base = p + <0, 2, 0>; base #end #macro ponta_grau2(p) #local ponta = p + <0, 3, 0>; ponta #end #macro vert_grau3(p) union { object { sphere { p, 2 texture{ tx_tanque_medio } } } object { cylinder{ p + <2, 0, 0>, p + <3, 0, 0>, 0.5 texture{ tx_cano } } } object { cylinder{ p + <0, 2, 0>, p + <0, 3, 0>, 0.5 texture{ tx_cano } } } object { cylinder{ p + <0, 0, 2>, p + <0, 0, 3>, 0.5 texture{ tx_cano } } } } #end #macro base_grau3(p) #local base = p + <0, 0, 2>; base #end #macro ponta_grau3(p) #local ponta = p + <0, 0, 3>; ponta #end #macro vert_grau4(p) union { object { sphere { p, 2 texture{ tx_tanque_medio } } } object { cylinder{ p + <2, 0, 0>, p + <3, 0, 0>, 0.5 texture{ tx_cano } } } object { cylinder{ p + <0, 2, 0>, p + <0, 3, 0>, 0.5 texture{ tx_cano } } } object { cylinder{ p + <0, 0, 2>, p + <0, 0, 3>, 0.5 texture{ tx_cano } } } object { cylinder{ p + <-2, 0, 0>, p + <-3, 0, 0>, 0.5 texture{ tx_cano } } } } #end #macro base_grau4(p) #local base = p + <0, -2, 0>; base #end #macro ponta_grau4(p) #local ponta = p + <0, -3, 0>; ponta #end #macro conector(na, Pini, Tini, Pfin, Tfin, D, nb) #local P1 = array[na]; #local P2 = array[na]; #declare roleta_ps = seed(3124124); #local P1[0] = Tini; #local P2[na - 1] = Tfin; #for (index_p1, 1, na - 1) #local xx = int(D*rand(roleta_ps)); #local yy = int(D*rand(roleta_ps)); #local zz = int(D*rand(roleta_ps)); #local P1[index_p1] = ; #end #for (index_p2, 0, na - 2) #local xx = int(D*rand(roleta_ps)); #local yy = int(D*rand(roleta_ps)); #local zz = int(D*rand(roleta_ps)); #local P2[index_p2] = ; #end union { #for (i, 0, na*nb - 1) #local pp = interpola_3_multi(i, Pini, nb, P1, P2, Pfin) sphere{ pp, 1 texture{ tx_black } } #end } #end #include "eixos.inc" // Aqui est� a cena, finalmente: union{ #declare org = array[6]; #declare org[0] = 0; #declare org[1] = 2; #declare org[2] = 2; #declare org[3] = 2; #declare org[4] = 1; #declare org[5] = 3; #declare dst = array[6]; #declare dst[0] = 2; #declare dst[1] = 0; #declare dst[2] = 1; #declare dst[3] = 0; #declare dst[4] = 3; #declare dst[5] = 3; object { gera_grafo(4, 6,org, dst, 35, 10, 10) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 2.00 >; #declare raio_cena = 60.0; #declare dir_camera = < 12.00, 20.00, 11.00 >; #declare dist_camera = 100*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)