// 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_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 1, 0, 0 >, color rgb < 0, 0, 0 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare tx_table_row = texture { pigment { // Define the background color color rgb <0.8, 0.8, 0.8> } finish { // Adjust the reflectivity and other surface properties ambient 0.3 diffuse 0.7 specular 0.2 reflection 0.3 } } #declare tx_table_row_border = texture { pigment { // Use a wood-like pattern for the border wood turbulence 0.5 color_map { [0.0 color rgb <0.4, 0.2, 0>] // Dark wood color [0.5 color rgb <0.4, 0.2, 0>] // Dark wood color [1.0 color rgb <0.8, 0.4, 0>] // Light wood color } } finish { ambient 0.2 diffuse 0.8 } } // Define a wood-like texture #declare tx_place = texture { pigment { checker color rgb <0.2, 0.2, 0.2>, color rgb <0.8, 0.8, 0.8> scale 0.5 // Adjust the scale of the checkers pattern } finish { ambient 0.2 diffuse 0.8 } } // Define a chess piece texture (white marble) #declare tx_node = texture { pigment { marble color_map { [0.0 color rgb <1, 1, 1>] // White color [0.7 color rgb <0.8, 0.8, 0.8>] // Light gray color } scale 0.5 // Adjust the scale of the marble pattern } finish { ambient 0.2 diffuse 0.8 specular 0.9 } } #declare tx_cano = texture { pigment { marble color_map { [0.0 color rgb <0, 0, 0>] // Black color [0.7 color rgb <0.1, 0.1, 0.1>] // Dark gray color } scale 0.5 // Adjust the scale of the marble pattern } finish { ambient 0.2 diffuse 0.8 specular 0.9 } } #declare tx_node = texture { pigment { rgb <0, 0.5, 1> } finish { ambient 0.2 diffuse 0.8 reflection 0.5 // Adjust the reflection level as desired } } // ====================================================================== // DESCRI��O DA CENA #declare raioSust = 0.25; #declare raioPoste = 0.5; #declare raioPerna = 0.5; #declare CyT1 = cylinder { <0, 0, 0>, <0, 0, 2>, 0.5 // center of one end, center of other end, radius } #declare CoT1 = cone { <0, 0, 2>, 0.5 // , center & radius of one end <0, 0, 3>, 0.1 // , center & radius of the other end } #declare CoT2 = cone { <0, 0, 0>, 0.75 // , center & radius of one end <0, 0, 2>, 0.25 // , center & radius of the other end } #declare EsT2 = sphere { <0, 0, 2>, 0.3 // , radius } #declare BoT3 = box { <-0.25, -0.25, 0>, <0.25, 0.25, 1.5> // near lower left corner, far upper right corner } #declare CyT3 = cylinder { <0, 0, 1.5>, <0, 0, 3>, 0.5 // center of one end, center of other end, radius } #declare ponta1 = cylinder { <0, 0, 0>, <0, 1, 0>, 0.1 } #macro ponta(inicio, fim) union{ object { cylinder { inicio, fim, 0.1 // center of one end, center of other end, radius } texture { tx_cano } } } #end #macro grau1(position) union{ object { sphere { <0,0,0>, 1 } translate position texture { tx_node } } object{ ponta(<0,1,0>, <0,1.5,0>) translate position } } #end #macro grau2(position) union { object{ cylinder { <0, 0, 0>, <0, 0, 0.75>, 0.5 // center of one end, center of other end, radius } translate position texture { tx_node } } object{ sphere { <0, 0, 1>, 0.75 // , radius } translate position texture { tx_node } } object{ cone { <0, 0, 1.6>, 0.5 // , center & radius of one end <0, 0, 2.4>, 0 // , center & radius of the other end } translate position texture { tx_node } } object{ ponta(<0, 0,1.9>, <0,0.7,1.9>) translate position } object{ ponta(<0,-0.5,0.25>, <0,-0.75,0.25>) translate position } } #end #macro grau3(position) union { object{ cylinder { <0, 0, 0.5>, <0, 0, 1.5>, 1 // center of one end, center of other end, radius } translate position texture { tx_node } } object{ box { <-0.3, -0.3, 2.5>, <0.3, 0.3, 1.5> // near lower left corner, far upper right corner } translate position texture { tx_node } } difference { object { sphere { <0, 0, 0>, 0.75 // , radius } translate position texture { tx_node } } object { cylinder { <0, 0, -1>, <0, 0, 0>, 1 // center of one end, center of other end, radius } } } object{ ponta(<0,1,1>, <0,1.5,1>) translate position } object{ ponta(<0,-0.3,0.2>, <0,-1,0.2>) translate position } object{ ponta(<0,0,2.5>, <0,0,3>) translate position } } #end #macro grau4(position) union { object{ cylinder { <0, 0, 2>, <0, 0, 3>, 0.3 // center of one end, center of other end, radius } translate position texture { tx_node } } object{ box { <-1, -1, 0.75>, <1, 1, 2> // near lower left corner, far upper right corner } translate position texture { tx_node } } object{ cone { <0, 0, 0>, 0// , center & radius of one end <0, 0, 0.75>, 0.5 // , center & radius of the other end } translate position texture { tx_node } } object{ ponta(<0,1,1.25>, <0,1.5,1.25>) translate position } object{ ponta(<0,-1,1.25>, <0,-1.5,1.25>) translate position } object{ ponta(<1,0,1.25>, <1.25,0,1.25>) translate position } object{ ponta(<0,0.2,2.5>, <0,0.75,2.5>) translate position } } #end #macro tubulacao(p, q) union{ #declare roleta2 = seed( 90 ); #declare altura = 9 * rand(roleta1) + 4; object{ cylinder{ p, , 0.1 } texture { tx_cano } } object{ cylinder{ q, , 0.1 } texture { tx_cano } } object{ cylinder{ , , 0.1 } texture { tx_cano } } } #end #macro faz_ligacao() union{ #local roleta3 = seed( 200 ); #local i = int( total_tocos * rand(roleta3) ); #local j = int( (total_tocos - 1) * rand(roleta3) ); #if (j = i) #local j = j + 1; #end #local p = A[i]; #local q = A[j]; object{ tubulacao(p, q) } #declare A[i] = A[total_tocos - 1]; #declare A[j] = A[total_tocos - 2]; #declare total_tocos = total_tocos - 2; } #end #macro interpolacao(tw, t0, v0, t1, v1) #local ss = (tw - t0) / (t1 - t0); #local vv = (1 - ss) * v0 + ss * v1; vv #end #macro interpolacaoBezier(g, ta, tb, v0, v1, v2, v3) #local v01 = interpolacao(g, ta, v0, tb, v1); #local v12 = interpolacao(g, ta, v1, tb, v2); #local v23 = interpolacao(g, ta, v2, tb, v3); #local v012 = interpolacao(g, ta, v01, tb, v12); #local v123 = interpolacao(g, ta, v12, tb, v23); #local v0123 = interpolacao(g, ta, v012, tb, v123); v0123 #end #macro testa_interpola(p0, p1, n, raio) union{ #local k = 0; #while (k < n) #local c = interpolacao(k, 2, p0, 4, p1); object { sphere { c, raio // , radius } texture { tx_xadrez } } #local k = k + 1; #end } #end #macro testa_interpola_curva(origem, p1, p2, destino, n, raio) union{ #local k = 0; #while (k < n) #local c = interpolacaoBezier(k, 1, n, origem, p1, p2, destino); object { sphere { c, raio // , radius } texture { tx_xadrez } } #local k = k + 1; #end } #end #macro interpola3_multi(tt, n, Pini, P1, P2, Pfim) #local k = int(tt); #local Q0 = Pini; #local Q2 = Pfim; #if (k > 0) #local Q0 = (P1[k] + P2[k - 1]) / 2; #end #if (k < n - 1) #local Q2 = (P1[k + 1] + P2[k]) / 2; #end #local c = interpolacaoBezier(tt, k, k + 1, Q0, P1[k], P2[k], Q2); c #end #macro testa_multi(n, Q0, P1, P2, Q2) union { #local tt = 0; #while (tt < n) #local c = interpola3_multi(tt, n, Q0, P1, P2, Q2); object { sphere { c, 0.5 // , radius } texture { tx_plastico } } #local tt = tt + 0.01; #end } #end #macro gera_grafo(m, n) union{ #declare MAX = 100; #declare totLig = 0; #declare A = array[ MAX ]; #declare ta = 0; #declare m0 = 1; #declare baseEspace = 4; #declare m02 = int(m / 2); #declare n02 = int(n / 2); #declare roleta1 = seed( 100 ); #declare roletax = seed( 25 ); #declare roletay = seed( 8 ); #declare roletaz = seed( 12 ); #while (m0 <= m) #declare n0 = 1; #while (n0 <= n) #declare x_n0 = int(rand(roletax) * 30); #declare y_n0 = int(rand(roletay) * 30); #declare z_n0 = int(rand(roletaz) * 10); #declare s = int(rand(roleta1) * 4); #if (mod(s, 4) = 1) object { grau1(; #declare ta = ta + 1; #declare totLig = totLig + 1; #else #if (mod(s, 4) = 1) object { grau2() } #declare A[ta] = ; #declare A[ta + 1] = ; #declare A[ta + 2] = ; #else #if (mod(s, 4) = 2) object { grau3() } #declare A[ta] = ; #declare A[ta + 1] = ; #declare A[ta + 2] = ; #else #if (mod(s, 4) = 3) object { grau4() } #declare A[ta] = ; #declare A[ta + 1] = ; #declare A[ta + 2] = ; #end #end #end #end #declare ta = ta + 3; #declare n0 = n0 + 1; #end #declare m0 = m0 + 1; #end #declare ta = 0; #declare nr_A = total_tocos; #while (total_tocos > 1) object{ faz_ligacao() } #end } #end #include "eixos.inc" // Aqui est� a cena, finalmente: union{ // object{ testa_interpola(<0,0,0>, <10,10,0>, 20, 1) } #local n = 3; #local P1 = array [ 3 ] #local P2 = array [ 3 ] #local P1[0] = <2, 0, 2>; #local P1[1] = <2, 5, 9>; #local P1[2] = <0, 4, 2>; #local P2[0] = <1, 2, 0>; #local P2[1] = <-2, 15, 0>; #local P2[2] = <-10, 1, -2>; object { testa_multi(3, <10, 10, 10>, P1, P2, <-5, -5, -5>) } object { testa_multi(1, <-10, 0, 10>, P1, P2, <-10, -20, -5>) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 2.00 >; #declare raio_cena = 20.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 100*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)