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} } } union{object{t1 translate}} #declare A[k] = <0 + xx,0 + yy,4>; #declare A[k+1] = <0 + xx, 1.25 + yy, 1.75>; #declare k = k+2; #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} } } union{object{t2 translate}} #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; #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 tanque4(xx,yy) #declare t4 = union{ sphere { <0, 0, 0>, 3 // , radius texture{tx_plastico} } cylinder { <0, 0, 0>, <4, 0, 4>, 1 // center of one end, center of other end, radius texture{tx_plastico} } } union{object{t4 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 interpola2_multi(tt, p_ini, n, p1, p2, p_fim) #local k = int(tt); #if (k = n) #declare k = n-1; #end #local q0 = <0,0,0>; #local q1 = <0,0,0>; #local q2 = <0,0,0>; #local q3 = <0,0,0>; #if (k = 0) #declare q0 = p_ini; #else #declare q0 = (p1[k] + p2[k-1]) / 2; #end #declare q1 = p1[k]; #declare q2 = p2[k]; #if (k = 2) #declare q3 = p_fim; #else #declare q3 = (p2[k] + p1[k+1]) / 2; #end #local pt = interpola2(tt, k, k+1, q0, q1, q2, q3); pt #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(5.00)} #local Pini = <0,0,0>; #local Pfim = <7,4,-1>; #local n = 3; #local P1 = array[n]; #local P1[0] = <1,-2,3>; #local P1[1] = <-4,7,5>; #local P1[2] = <3,6,-1>; #local P2 = array[n]; #local P2[0] = <-3,-2,1>; #local P2[1] = <7,4,-1>; #local P2[2] = <1,3,6>; union{ //Esferas pretas representam os pontos de fim e inicio// sphere { Pfim, 0.2 // , radius } sphere { Pini, 0.2 // , radius } #declare tt = 0.0; #while(tt <= 3.0) #local pt = interpola2_multi(tt, Pini, n, P1, P2, Pfim); sphere {pt, 0.2 texture{tx_plastico}} #declare tt = tt + 0.001; #end } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 10.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)