background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare chao = box{ <-20,-20,-1>, <+20,+20,0> texture{tx_xadrez}} #declare toco= cylinder { <0,0,0>, <0.1,0,0>, 0.05 texture{ pigment{ color rgb < 0.5, 0.5, 0.5 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } #declare tocos1 = array[1] {<0.45,0,0.8>} #declare vertice1= union { cylinder { <0,0,0>, <0,0,0.3>, 0.5 texture{ pigment{ color rgb < 0.90, 0.30, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } cylinder { <0,0,0.3>, <0,0,1.0>, 0.35 texture{ pigment{ color rgb < 0.80, 0.30, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco translate<0.35,0,0.8> } } #declare tocos2= array[2] {<0.17,0,0.8>,<-0.17,0,0.8>} #declare vertice2= union { box { <-0.5,-0.5,0>, <0.5,0.5,0.2> texture{ pigment{ color rgb < 0.6, 0.6, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } cone { <0,0,0.2>, 0.4 <0,0,1>, 0 texture{ pigment{ color rgb < 0.8, 0.8, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco translate<0.07,0,0.8> } object { toco rotate 180*z translate<-0.07,0,0.8> } } #declare tocos3= array[3] {<0.3,0,0.8>,<-0.15,0.258,0.8>,<-0.15,-0.258,0.8>} #declare vertice3= union{ sphere{ <0,0,0.3>, 0.3 texture{ pigment{ color rgb < 0.3, 0.9, 0.3 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } sphere { <0,0,0.8>, 0.2 texture{ pigment{ color rgb < 0.4, 0.9, 0.4 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco translate<0.2,0,0.8> } object { toco rotate 120*z translate<-0.1,0.172,0.8> } object { toco rotate 240*z translate<-0.1,-0.172,0.8> } } #declare tocos4= array[4] {<0.4,0,0.8>,<0,0.4,0.8>,<-0.4,0,0.8>,<0,-0.4,0.8>,} #declare vertice4= union { box{ <-0.4,-0.4,0>, <0.4,0.4,0.5> texture{ pigment{ color rgb < 0.9, 0.9, 0.9 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } box{ <-0.3,-0.3,0.5>, <0.3,0.3,1> texture{ pigment{ color rgb < 1, 1, 1 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco translate<0.3,0,0.8> } object { toco rotate 90*z translate<0,0.3,0.8> } object { toco rotate 180*z translate<-0.3,0,0.8> } object { toco rotate 270*z translate<0,-0.3,0.8> } } #macro interpola(ti,t0,v0,t1,v1) #local ss = (ti-t0)/(t1-t0); #local vv = (1-ss)*v0+ss*v1; vv #end #macro bezier2(ti,t0,t1,p0,p1,p2) #local b1 = interpola(ti,t0,p0,t1,p1); #local b2 = interpola(ti,t0,p1,t1,p2); interpola(ti,t0,b1,t1,b2) #end #macro bezier3(ti,t0,t1,p0,p1,p2,p3) #local b1 = bezier2(ti,t0,t1,p0,p1,p2); #local b2 = bezier2(ti,t0,t1,p1,p2,p3); interpola(ti,t0,b1,t1,b2) #end #macro testa_interpola_1(p0,p1,n,raio) union{ #local i = 0; #while (i < n) sphere{ interpola(i,0,p0,n,p1), raio } #local i = i+1; #end } #end #macro interpola_3_multi(ti,p0,n,P1,P2,pf) #local inter = array[n+1]; #local i = 0; #local inter[0] = p0; #local inter[n] = pf; #while(i=n) #local k=n-1; #end bezier3(ti-k,0,1,inter[k],P1[k],P2[k],inter[k+1]) #end #include "bezpoly.inc" #declare tx_bug = texture{ pigment{ color rgb < 0.200, 0.800, 0.000 > } finish{ diffuse 0.5 ambient 0.5 } } #macro testa_interpola_3_multi(p0,pf,P1,P2,n,k,raio) union{ object{ bezpoly_multi(n, p0, P1, P2, pf, 0.9*raio) } #local i = 0; #while (i < k) sphere{ interpola_3_multi(n*i/k,p0,n,P1,P2,pf), raio texture{ tx_bug } } #local i = i+1; #end } #end #declare t_point= texture{ pigment{ color rgb < 1, 0, 0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } union { #declare V1=array[3] {<1,1,0>,<3,-2,0>,<2,-5,0>}; #declare V2=array[3] {<2,1,0>,<5,-1,0>,<1,-2,0>}; sphere {(V2[0]+V1[1])/2, .08 texture {t_point}} // intermediario esperado 1 sphere {(V2[1]+V1[2])/2, .08 texture {t_point}} // intermediario esperado 2 testa_interpola_3_multi(<0,0,0>,<1,-4,0>,V1,V2,3,500,0.05) } #include "eixos.inc" // object{ eixos(5) } #declare cmin = < -1,-6,-1 >; #declare cmax = < +6,+2,+2 >; box{ cmin, texture{ pigment{ color rgb <0.80,0.70,0.60> } 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 = < 5, 3, 4 >; // <0.0001, 0, 1 >; // #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)