//Lucas Felix 136625 // ====================================================================== background{ color rgb < 0.15, 0.80, 0.55 > } #declare Yellow = rgb<255, 255, 0>; #declare Black = rgb < 0.4, 0.2, 0.8 >; #declare cor_segmento = texture{ pigment{ color rgb < 0.10, 0.10, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare cor_articulacao = texture{ pigment{ color rgb < 0.50, 0.30, 0.80 > } } // ====================================================================== // MATRIZ DE ANGULOS PARA CADA PERNA #declare Graus = array[6][5][3]; //[Perna][Grau][Quadro] // ======== QUADRO 0 ======== //PERNA 1 #declare Graus[0][0][0] = 45; #declare Graus[0][1][0] = 45; #declare Graus[0][2][0] = 45; #declare Graus[0][3][0] = 45; #declare Graus[0][4][0] = 45; //PERNA 2 #declare Graus[1][0][0] = 45; #declare Graus[1][1][0] = 45; #declare Graus[1][2][0] = 45; #declare Graus[1][3][0] = 45; #declare Graus[1][4][0] = 45; //PERNA 3 #declare Graus[2][0][0] = 45; #declare Graus[2][1][0] = 45; #declare Graus[2][2][0] = 45; #declare Graus[2][3][0] = 45; #declare Graus[2][4][0] = 45; //PERNA 4 #declare Graus[3][0][0] = 45; #declare Graus[3][1][0] = 45; #declare Graus[3][2][0] = 45; #declare Graus[3][3][0] = 45; #declare Graus[3][4][0] = 45; //PERNA 5 #declare Graus[4][0][0] = 45; #declare Graus[4][1][0] = 45; #declare Graus[4][2][0] = 45; #declare Graus[4][3][0] = 45; #declare Graus[4][4][0] = 45; //PERNA 6 #declare Graus[5][0][0] = 45; #declare Graus[5][1][0] = 45; #declare Graus[5][2][0] = 45; #declare Graus[5][3][0] = 45; #declare Graus[5][4][0] = 45; // ======== QUADRO 1 ======== //PERNA 1 #declare Graus[0][0][1] = 135; #declare Graus[0][1][1] = 135; #declare Graus[0][2][1] = 135; #declare Graus[0][3][1] = 135; #declare Graus[0][4][1] = 135; //PERNA 2 #declare Graus[1][0][1] = 135; #declare Graus[1][1][1] = 135; #declare Graus[1][2][1] = 135; #declare Graus[1][3][1] = 135; #declare Graus[1][4][1] = 135; //PERNA 3 #declare Graus[2][0][1] = 135; #declare Graus[2][1][1] = 135; #declare Graus[2][2][1] = 135; #declare Graus[2][3][1] = 135; #declare Graus[2][4][1] = 135; //PERNA 4 #declare Graus[3][0][1] = 135; #declare Graus[3][1][1] = 135; #declare Graus[3][2][1] = 135; #declare Graus[3][3][1] = 135; #declare Graus[3][4][1] = 135; //PERNA 5 #declare Graus[4][0][1] = 135; #declare Graus[4][1][1] = 135; #declare Graus[4][2][1] = 135; #declare Graus[4][3][1] = 135; #declare Graus[4][4][1] = 135; //PERNA 6 #declare Graus[5][0][1] = 135; #declare Graus[5][1][1] = 135; #declare Graus[5][2][1] = 135; #declare Graus[5][3][1] = 135; #declare Graus[5][4][1] = 135; // ======== QUADRO 2 ======== //PERNA 1 #declare Graus[0][0][2] = 45; #declare Graus[0][1][2] = 45; #declare Graus[0][2][2] = 45; #declare Graus[0][3][2] = 45; #declare Graus[0][4][2] = 45; //PERNA 2 #declare Graus[1][0][2] = 45; #declare Graus[1][1][2] = 45; #declare Graus[1][2][2] = 45; #declare Graus[1][3][2] = 45; #declare Graus[1][4][2] = 45; //PERNA 3 #declare Graus[2][0][2] = 45; #declare Graus[2][1][2] = 45; #declare Graus[2][2][2] = 45; #declare Graus[2][3][2] = 45; #declare Graus[2][4][2] = 45; //PERNA 4 #declare Graus[3][0][2] = 45; #declare Graus[3][1][2] = 45; #declare Graus[3][2][2] = 45; #declare Graus[3][3][2] = 45; #declare Graus[3][4][2] = 45; //PERNA 5 #declare Graus[4][0][2] = 45; #declare Graus[4][1][2] = 45; #declare Graus[4][2][2] = 45; #declare Graus[4][3][2] = 45; #declare Graus[4][4][2] = 45; //PERNA 6 #declare Graus[5][0][2] = 45; #declare Graus[5][1][2] = 45; #declare Graus[5][2][2] = 45; #declare Graus[5][3][2] = 45; #declare Graus[5][4][2] = 45; //Definição dos tempos tk #declare nk = 3; #declare tk = array[nk] #declare tk[0] = 0.0000; #declare tk[1] = 0.5000; #declare tk[2] = 1.0000; //matriz com os angulos #declare NP = 6; #declare NA = 5; #declare NQ = 8; #declare A = array[NP][NA]; #declare A[0][0] = 0; #declare A[0][1] = 0; #declare A[0][2] = 0; #declare A[0][3] = 0; #declare A[0][4] = 0; #declare A[1][0] = 0; #declare A[1][1] = 0; #declare A[1][2] = 0; #declare A[1][3] = 0; #declare A[1][4] = 0; #declare A[2][0] = 0; #declare A[2][1] = 0; #declare A[2][2] = 0; #declare A[2][3] = 0; #declare A[2][4] = 0; #declare A[3][0] = 0; #declare A[3][1] = 0; #declare A[3][2] = 0; #declare A[3][3] = 0; #declare A[3][4] = 0; #declare A[4][0] = 0; #declare A[4][1] = 0; #declare A[4][2] = 0; #declare A[4][3] = 0; #declare A[4][4] = 0; #declare A[5][0] = 0; #declare A[5][1] = 0; #declare A[5][2] = 0; #declare A[5][3] = 0; #declare A[5][4] = 0; // ====================================================================== // DECLARAÇÃO DOS OBJETOS #declare P1 = union{ sphere{ < 0.00, 0.00, 0.00 >, 0.5 texture{ cor_articulacao } } box{ < -0.5, 0.0, -0.25 >,< 0.5, 2.0, 0.25> texture{ cor_segmento } } } #declare P2 = union{ sphere{ < 0.00, 0.00, 0.00 >, 0.5 texture{ cor_articulacao } } box{ < -0.5, 0.0, -0.25 >,< 0.5, 3.0, 0.25> texture{ cor_segmento } } } #declare P3 = union{ sphere{ < 0.00, 0.00, 0.00 >, 0.5 texture{ cor_articulacao } } box{ < -0.5, 0.0, -0.25 >,< 0.5, 4.0, 0.25> texture{ cor_segmento } } } #declare P4 = union{ sphere{ < 0.00, 0.00, 0.00 >, 0.5 texture{ cor_articulacao } } box{ < -0.5, 0.0, -0.25 >,< 0.5, 6.0, 0.25> texture{ cor_segmento } } } #declare P5 = union{ sphere{ < 0.00, 0.00, 0.00 >, 0.5 texture{ cor_articulacao } } box{ < 0.0, 0.0, -0.25 >,< 0.5, 6.0, 0.25> texture{ cor_segmento } } } #declare Corpo = union{ box{ < -2.5, 0.0, 0.0 >,< 2.5, 15, 5> texture{ cor_segmento } } } // ====================================================================== // FUNÇÕES SECUNDARIAS DE CRIAÇÃO DOS MEMBROS #macro S1() object{P1} #end #macro S2(Alf) union { object {S1() rotate < Alf,0,0 > translate < 0,3,0 > } //Note: a ordem entre rotate e translate IMPORTA!!! object {P2}} #end #macro S3(Alf,Bet) union { object {S2(Alf) rotate < -Bet,0,0 > translate < 0,4,0 > } object {P3}} #end #macro S4(Alf,Bet,Gam) union { object {S3(Alf,Bet) rotate < Gam,0,0 > translate < 0,6,0 > } object {P4}} #end #macro Perna(Alf,Bet,Gam,Ro) union { object {S4(Alf,Bet,Gam) rotate < -Ro,0,0 > translate < 0,6,0 > } object {P5}} #end #macro Dragao(Graus) union { object {Corpo} object {Perna(Graus[0][0],Graus[0][1],Graus[0][2],Graus[0][3]) rotate <-90,0,-90> rotate <0,45,0> translate < -2,1,0 >} object {Perna(Graus[1][0],Graus[1][1],Graus[1][2],Graus[1][3]) rotate <-90,0,-90> rotate <0,-45,0> translate < 2,1,0 >} object {Perna(Graus[2][0],Graus[2][1],Graus[2][2],Graus[2][3]) rotate <-90,0,-90> rotate <0,45,0> translate < -2,7.5,0 >} object {Perna(Graus[3][0],Graus[3][1],Graus[3][2],Graus[3][3]) rotate <-90,0,-90> rotate <0,-45,0> translate < 2,7.5,0 >} object {Perna(Graus[4][0],Graus[4][1],Graus[4][2],Graus[4][3]) rotate <-90,0,-90> rotate <0,45,0> translate < -2,14,0 >} object {Perna(Graus[5][0],Graus[5][1],Graus[5][2],Graus[5][3]) rotate <-90,0,-90> rotate <0,-45,0> translate < 2,14,0 >} } #end // ====================================================================== //FUNÇÕES DE ANIMAÇÃO #macro interpola(to, vo, t1, v1, tt ) #local r = (tt-to)/(t1-to); #local s = 1-r; #local vv= s*vo+r*v1; vv #end #macro interpolaMatriz(NP, NA, Q, k0, t0, k1, t1, tt, A) #local i=0; #while (i; #declare raio_cena = 20.0; #declare dir_camera = < 14.00, 14.00, 4.00 >; #declare dist_camera = 34*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)