background{ color rgb < 0.75, 0.80, 0.85 > } #include "eixos.inc" #declare tx_plastico = texture{ pigment{ color rgb < 0.1, 1, 1 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 1, 1, 1 >, color rgb < 0, 0, 0 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare A = array[1000]; #declare k = 0; #macro tanque1(xx,yy) #declare t1 = union{ cone { <0, 0, 0>, 1.0 // , center & radius of one end <0, 0, 1.25>, 0.5 // , center & radius of the other end texture{tx_plastico} } cylinder { <0, 0, 0>, <0, 0, 2.25>, 0.5 // center of one end, center of other end, radius texture{tx_plastico} } cone { <0, 0, 2.25>, 0.5 // , center & radius of one end <0, 0, 3.5>, 1.0 // , center & radius of the other end texture{tx_plastico} } cylinder { <0, 0, 3.5>, <0, 0, 4>, 0.25 // center of one end, center of other end, radius texture{tx_plastico} } cylinder { <0, 0, 1.75>, <0, 1.25, 1.75>, 0.25 // center of one end, center of other end, radius texture {tx_plastico} } } #declare A[k] = <0 + xx,0 + yy,4>; #declare A[k+1] = <0 + xx, 1.25 + yy, 1.75>; #declare k = k+2; union{object{t1 translate}} #end #macro tanque2(xx,yy) #declare t2 = union{ cylinder { <0, 0, 0>, <0, 0, 1.5>, 0.75 // center of one end, center of other end, radius texture{tx_plastico} } cone { <0, 0, 1.5>, 1.0 // , center & radius of one end <0, 0, 2.5>, 0.5 // , center & radius of the other end texture{tx_plastico} } sphere { <0, 0, 3>, 0.75 // , radius texture {tx_plastico} } cylinder { <0, 0, 3.25>, <0, 0, 4>, 0.25// center of one end, center of other end, radius texture{tx_plastico} } cylinder { <0, 0, 0.5>, <1.25, 1.25, 1>, 0.25 // center of one end, center of other end, radius texture{tx_plastico} } cylinder { <0, 0, 0.5>, <-1.25, 1.25, 1>, 0.25 // center of one end, center of other end, radius texture{tx_plastico} } } #declare A[k] = <0 + xx, 0 + yy, 4>; #declare A[k+1] = <1.25 + xx, 1.25 + yy, 1>; #declare A[k+2] = <-1.25 + xx, 1.25 + yy, 1>; #declare k = k + 3; union{object{t2 translate}} #end #macro tanque3(xx,yy) #declare t3 = union{ box { <0, 0, 0>, <2, 2, 2> // near lower left corner, far upper right corner texture{tx_plastico} } cylinder { <1, 1, 2>, <1, 1, 3.5>, 0.75// center of one end, center of other end, radius texture{tx_plastico} } cylinder { <1, 1, 2>, <1, 1, 4>, 0.25// center of one end, center of other end, radius texture{tx_plastico} } cylinder { <1, -0.5, 1>, <1, 2.5, 1>, 0.25// center of one end, center of other end, radius texture{tx_plastico} } cylinder { <1, -0.5, 1>, <1, 2.5, 1>, 0.25// center of one end, center of other end, radius texture{tx_plastico} } } union{object{t3 translate}} #end #macro interpola1(k,t0,v0,t1,v1) #local ss = (k-t0)/(t1-t0); #local vv = (1-ss)*v0 + (ss*v1); vv #end #macro interpola2(k,ta,tb,v0,v1,v2,v3) #local v01 = interpola1(k,ta,v0,tb,v1); #local v12 = interpola1(k,ta,v1,tb,v2); #local v23 = interpola1(k,ta,v2,tb,v3); #local v012 = interpola1(k,ta,v01,tb,v12); #local v123 = interpola1(k,ta,v12,tb,v23); #local v0123 = interpola1(k,ta,v012,tb,v123); v0123 #end #macro teste1(p0,p1,n,raio) union{ #declare i = 1; #while(i != n+1) #local centro = interpola1(i,0,p0,n+1,p1); object{sphere{centro,raio}} #declare i = i + 1; #end } #end #macro teste2(p0,p1,p2,p3,n,raio) union{ #declare i = 1; #while(i != n+1) #local centro = interpola2(i,0,n+1,p0,p1,p2,p3); object{sphere{centro,raio texture{tx_plastico}}} #declare i = i + 1; #end } #end // object{eixos(10.00)} object{ tanque1(0,0) } object{ tanque2(6,8) } object{ tanque3(6,0) } teste2(A[0], <-1,-9,6>, <4,12,4>, A[4],2000,0.25) teste2(A[1], <-3,8,2>, <12,5,-3>, A[3],2000, 0.25) #declare cmin = < -2,-3,-2 >; #declare cmax = < +9,+10,+6 >; box{ cmin-<2,2,0> +<2,2,0.01> texture{ pigment{ color rgb 0.9*<1,1,1> } finish {diffuse 0.7 ambient 0.3 } } } #include "camlight.inc" #declare centro_cena = (cmin + cmax)/2; #declare raio_cena = 0.5*vlength(cmin - cmax); #declare dir_camera = < -40, 20, 20 >; #declare dist_camera = 7*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)