background{ color rgb < 0.75, 0.80, 0.85 > } #macro pe(rc) union { // pé cylinder { <0,0,0> <0,0,-0.2> 0.3 texture { pigment { color rgb <1,1,1>} } } sphere { <0,0,0> 0.2 texture { pigment { color rgb <1,1,1>} } } rotate rc } #end #macro perna2(rb, rc) #local cb = 0.6; union { // perna 2 union { // pé pe(rc) translate <0,0,-cb> } cylinder { <0,0,0> <0,0,-cb> 0.2 texture { pigment { color rgb <0,0,1>} } } sphere { <0,0,0> 0.2 texture { pigment { color rgb <0,0,1>} } } rotate rb } #end #macro perna(ra, rb, rc) #local ca = 0.7; union { // perna 1 union { perna2(rb,rc) translate <0,0,-ca> } cylinder { <0,0,0> <0,0,-ca> 0.2 texture { pigment { color rgb <1,1,0>} } } sphere { <0,0,0> 0.2 texture { pigment { color rgb <1,1,0>} } } rotate ra } #end #macro mandibula(p3) union { box { <0,-0.3,0> <0.5,0.3,-0.1> texture { pigment { color rgb <1,1,1>} } } rotate p3 } #end #macro cabeca(p2,p3) union { union { mandibula(p3) translate <0.1,0,-0.3> } box { <0,-0.3,-0.3> <0.6,0.3,0.3> texture { pigment { color rgb <0,0,1>} } } sphere { <0,0,0> 0.2 texture { pigment { color rgb <0,0,1>} } } rotate p2 } #end #macro pescoco(p1,p2,p3) union { union { cabeca(p2,p3) translate <0.5,0,0> } cylinder { <0,0,0> <0.5,0,0> 0.2 pigment { color rgb <1,1,0>} } sphere { <0,0,0> 0.2 texture { pigment { color rgb <1,1,0>} } } rotate p1 } #end #macro torax(p1,p2,p3,e1,e2,e3,d1,d2,d3) union { sphere { <0,0,0> 0.8 texture { pigment { color rgb <0,1,0>} } } union { pescoco(p1,p2,p3) translate <0.8,0,0> } union { perna(e1,e2,e3) translate <0,0.8,0> } union { perna(d1,d2,d3) translate <0,-0.8,0> } } #end #macro rabo(r1) union { cylinder { <0,0,0> <-0.5,0,0> 0.15 texture { pigment { color rgb <1,1,0>} } } sphere { <0,0,0> 0.15 texture { pigment { color rgb <1,1,0>} } } sphere { <-0.5,0,0> 0.15 texture { pigment { color rgb <1,1,0>} } } rotate r1 } #end #macro abdomen(e1,e2,e3,d1,d2,d3,r1) union { sphere { <0,0,0> 0.8 texture { pigment { color rgb <0,1,0>} } } union { perna(e1,e2,e3) translate <0,0.8,0> } union { perna(d1,d2,d3) translate <0,-0.8,0> } union { rabo(r1) translate <-0.8,0,0> } translate <-0.8,0,0> } #end #macro robo(p1,p2,p3,e11,e12,e13,e21,e22,e23,d11,d12,d13,d21,d22,d23,r1,c1) union { torax(p1,p2,p3,e11,e12,e13,d11,d12,d13) union { abdomen(e21,e22,e23,d21,d22,d23,r1) rotate c1 translate <-0.8,0,0> } } #end #declare e = <0,0,0>; #macro periodic(clk) #if (clk >= 0.5) #local time = 1.0-clk; #else #local time = clk; #end time #end #macro byClock(clk) #local time = periodic(clk); robo(<0,45,0>,<0,45,0>,<0,time*60,0>,,<0,0,0>,<0,0,0>,,<0,0,0>,<0,0,0>,,<0,0,0>,<0,0,0>,,<0,0,0>,<0,0,0>,<0,time*60,0>,<0,0,0>) #end union { box{ <-1000,-1000,0> <1000,1000,-0.1> texture { pigment { color rgb <0,0.5,0.2>} } translate <0,0,-1.4> } union { // pesc cab boca omb esq brac esq mao esq per esq joe esq pe esq omb dir brac dir mao dir per dir joe dir pe dir rabo corpo //robo(<0,45,0>,<0,45,0>,<0,30,0>,<180,90,0>,<0,0,0>,<0,0,0>,<90,90,0>,<0,0,0>,<0,0,0>,<-180,90,0>,<0,0,0>,<0,0,0>,<-90,90,0>,<0,0,0>,<0,0,0>,<0,0,0>,<0,0,0>) byClock(clock) rotate -90*y translate <-2,-2,2> } //union { // robo(e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e) // rotate 90*z // translate <-20, -2, 4> //} } #include "camlight.inc" #declare centro_cena = < 0, 0, 0>; #declare raio_cena = 5; #declare dir_camera = < 1, 0, 0 >; #declare dist_camera = raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)