#include "eixos.inc" background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_branco = texture{ pigment{ color rgb < 1.00, 1, 1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_cinza = texture{ pigment{ color rgb < 0.7, 0.7, 0.7 > } finish{ diffuse 0.9 ambient 0.1 } } #declare caixa = box { < -1, -1, 0 >, < 1, 1, 1> } #declare conSection = cone { <0, 0, 0>, 1 <0, 0, 1>, 0.5 } #declare bola = object { sphere{ < 0,0,0 >, 1 } texture{ tx_cinza }} #declare cilindro = cylinder{ < 0, 0, 0 >, < 0, 0, 1 >, 1 } #declare toco = object { cilindro scale < 0.3, 0.3, 2 > texture{ tx_cinza } } #declare tanque1 = union { union { object { cilindro scale <1, 1, 3> } object { bola translate <0, 0, 3> } texture{ tx_branco } } object { toco translate < 0, 0, 3 > } object { toco rotate < 90, 0, 0 > translate < 0, 0, 2 > } } #declare tanque2 = union { object { caixa scale <1, 1, 3> texture{ tx_branco } } object { toco translate < 0, 0, 3 > } object { toco rotate < 90, 0, 0 > translate < 0, 0, 2 > } object { toco rotate <0, 90, 0 > translate < 0, 0, 1 > } object { toco rotate <-90, 0, 0 > translate < 0, 0, 1 > } } #declare tanque3 = union { object { object { conSection } scale <1, 1, 3> texture{ tx_branco } } object { toco translate < 0, 0, 3 > } object { toco rotate < 90, 0, 0 > translate < 0, 0, 2 > } object { toco rotate <0, 90, 0 > translate < 0, 0, 1 > } } #declare scaleAxis = 5; #declare roleta = seed(7); #macro gera_tanques(m, n) #declare indexX = 0; #while (indexX < m) #declare indexY = 0; #while (indexY < n) #local random = rand(roleta); #if (random < 0.33) object { tanque1 translate < indexX * scaleAxis, indexY * scaleAxis, 0 >} #else #if (random < 0.66) object { tanque2 translate < (indexX * scaleAxis), indexY * scaleAxis, 0 >} #else object { tanque3 translate < indexX * scaleAxis, indexY * scaleAxis, 0 >} #end #end #declare indexY = indexY + 1; #end #declare indexX = indexX + 1; #end #end // #declare mm = 3; // #declare nn = 2; // #declare tocoQtPorTanque = 3; // #declare ttToco = mm * nn * tocoQtPorTanque; // #declare tocosArray = array[ttToco]; // #macro gera_tanques(m, n) // #declare indiceArray = 0; // #declare indexX = 0; // #while (indexX < m) // #declare indexY = 0; // #while (indexY < n) // #local random = rand(roleta); // #if (random < 0.33) // object { tanque1 translate < indexX * scaleAxis, indexY * scaleAxis, 0 >} // #else // #if (random < 0.66) // object { tanque2 translate < indexX * scaleAxis, indexY * scaleAxis, 0 >} // #else // object { tanque3 translate < indexX * scaleAxis, indexY * scaleAxis, 0 >} // #end // #end // #declare tocosArray[indiceArray] = < indexX * scaleAxis, indexY * scaleAxis, 5 >; // #declare tocosArray[indiceArray + 1] = < (indexX * scaleAxis) - 2, indexY * scaleAxis, 2 >; // #declare tocosArray[indiceArray + 2] = < indexX * scaleAxis, (indexY * scaleAxis) + 2, 1 >; // #declare indiceArray = indiceArray + 3; // #declare indexY = indexY + 1; // #end // #declare indexX = indexX + 1; // #end // #end #macro interpola1(tx, to, vo, t1, v1) #local ss = (tx - to)/(t1 - to); #local vv = ((1 - ss) * vo) + (ss * v1); vv #end #macro testa_interporla_1(po, p1, n, raio) union { #declare indice = 0; #while (indice < n) #local centro = interpola1(indice, 0, po, n, p1); object { bola scale translate centro } #declare indice = indice + 1; #end } #end #macro interpola3(tx, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(tx, ta, v0, tb, v1); #local v12 = interpola1(tx, ta, v1, tb, v2); #local v23 = interpola1(tx, ta, v2, tb, v3); #local v012 = interpola1(tx, ta, v01, tb, v12); #local v123 = interpola1(tx, ta, v12, tb, v23); #local v0123 = interpola1(tx, ta, v012, tb, v123); v0123 #end #macro testa_interporla_3(po, p1, p2, p3, n, raio) union { #declare indice = 0; #while (indice < n) #local centro = interpola3(indice, 0, n, po, p1, p2, p3); object { bola scale translate centro } #declare indice = indice + 1; #end } #end // #macro gera_tubulacoes(ttToco) // #declare indiceArray = 0 // #while (indiceArray < ttToco) // union { // object { cilindro } // } // #end // #end #macro conecta_tubo(v0, v3) object { tanque2 translate v0} object { tanque1 translate v3} #local toco1 = v0 + < 0, 0, 5>; #local toco2 = v3 + < 0, -2, 2>; testa_interporla_3(toco1, toco1 + <0, 0, 12>, toco2 + <0, -4, 0>, toco2, 200, raio) #end #declare v0 = < 0, 0, 0 >; #declare v1 = <0, 3, 20 >; #declare v2 = <0, 7, -10 >; #declare v3 = <0, 10, 0>; #declare raio = 0.5; union { object{ eixos(10.00) } // testa_interporla_3(v0, v1, v2, v3, 200, raio) conecta_tubo(v0, v3) // testa_interporla_1(v0, v3, 200, raio) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 20.0; #declare dir_camera = < 1, 1, 1 >; #declare dist_camera = 3*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)