//Pedro Feniman 083991 // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico2 = texture{ pigment{ color rgb < 0.2, 0.2, 0.2 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // ====================================================================== // DESCRIÇÃO DA CENA #macro bit (valor) #if(valor = 1) union{ cylinder{ < 0, 0, 0 >, < 0, 0, 1 >, 0.2 texture{ tx_plastico2 } } torus{ 0.35, 0.12 //raio maior e menor rotate -90*x translate <0, 0, 0.8> texture{ tx_plastico2 } } } #end #if(valor = 0) union{ cylinder{ < 0, 0, 0 >, < 0, 0, 1 >, 0.2 texture{ tx_plastico2 } } torus{ 0.35, 0.15 //raio maior e menor rotate -90*x translate <0, 0, 0.2> texture{ tx_plastico2 } } } #end #end #macro fileira(nbits, numero) union{ #local i = 0; #local nb = nbits; #while(nb != 0) #if (mod(numero ,2) = 1) object {bit(1) translate<0, -i*1, 0>} #else object {bit(0) translate<0, -i*1, 0>} #end #local i = i + 1; #local numero = int(numero/2); #local nb = nb - 1; #end } #end #declare valores = array [5]; #declare valores [0] = 2; #declare valores [1] = 4; #declare valores [2] = 6; #declare valores [3] = 8; #declare valores [4] = 10; #declare valores1 = array [4]; #declare valores1 [0] = 3; #declare valores1 [1] = 6; #declare valores1 [2] = 9; #declare valores1 [3] = 12; #macro abaco(m, n, valores) #local i = 0; union{ #while(i < m) object {fileira (n, valores[i]) translate <0, 0, i>} //object {apoio translate <0, 0, i+1>} #local i = i+1; box { <-0.25 ,0.5-1*n, 0> <0.25, 0.6 , 0.1> texture{ tx_plastico2 } translate <0, 0, i> } #end difference{ box { < -0.25 ,0.5-1*n, 0> <0.25, 0.6, 1*m> texture{ tx_plastico2 } } box { < -1 ,0.6-1*n, 0.2> <1, 0.5, 1*m> texture{ tx_plastico2 } } } } #end object { abaco (5, 5, valores) } object { abaco (4, 6, valores1) translate <0, 6, 6> } #include "eixos.inc" object{ eixos(3.00) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 5.0 >; #declare raio_cena = 10.0; #declare dir_camera = < 50.00, 10.00, 10.00 >; #declare dist_camera = 20.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)