#include "colors.inc" #include "shapes.inc" #include "camlight.inc" #include "eixos.inc" #declare component_color = texture { pigment { color rgb <0.4, 0.4, 0.4> } } #macro Pedaco(ra, rb, rc) union { sphere { 0.0, 0.32 } object { cylinder { <0, 0, 0>, <0, 1.2, 0>, 0.2 } rotate } } #end #macro Ped0(a) object { Pedaco(a, 0, 0) texture { component_color } } #end #macro Ped1(a, b) union { object { Pedaco(a, 0, 0) texture { component_color } } object { Ped0(b) translate <0, 1.2, 0> rotate } } #end #macro Ped2(a, b, c) union { object { Pedaco(a, 0, 0) texture { component_color } } object { Ped1(b, c) translate <0, 1.2, 0> rotate } } #end #macro Ped3(a, b, c, d) union { object { Pedaco(a, 0, 0) texture { component_color } } object { Ped2(b, c, d) translate <0, 1.2, 0> rotate } } #end #macro dragao(position, A) union { sphere { 0, 1.3 texture { component_color } } sphere { <0, 0, -2>, 1.3 texture { component_color } } sphere { <0, 0, 2>, 1.3 texture { component_color } } object { Ped3(A[0][0], A[0][1], A[0][2], A[0][3]) translate <0, 1.5, 2> } object { Ped3(A[1][0], A[1][1], A[1][2], A[1][3]) translate <0, 1.5, 0> } object { Ped3(A[2][0], A[2][1], A[2][2], A[2][3]) translate <0, 1.5, -2> } object { Ped3(A[3][0], A[3][1], A[3][2], A[3][3]) translate <0, 1.5, 2> scale <0, -1, 0> } object { Ped3(A[4][0], A[4][1], A[4][2], A[4][3]) translate <0, 1.5, 0> scale <0, -1, 0> } object { Ped3(A[5][0], A[5][1], A[5][2], A[5][3]) translate <0, 1.5, -2> scale <0, -1, 0> } } #end #declare center = <0.00, 0.00, 0.00>; #declare scene_radius = 9.3; #declare camera_direction = <4.2, 0.01, 0.01>; #declare camera_distance = 5.1 * scene_radius; #declare light_intensity = 0.6; camlight( center, scene_radius, camera_direction, camera_distance, z, light_intensity ) background { color rgb <0.7, 0.7, 0.7> } #macro interpola(v0, v1, t0, t1, tt) #local rr = (tt - t0)/(t1 - t0); #local ss = 1 - rr; #local vv = ss * v0 + rr * v1; vv #end #macro interpola_quadros(NP, NA, Q, k0, t0, k1, t1, tt) #local interpolacao = array[NP][NA]; #for (i, 0, NP - 1, 1) #for (j, 0, NA - 1, 1) #local a0 = Q[k0]; #local a1 = Q[k1]; #declare interpolacao[i][j] = interpola(a0[i][j], a1[i][j], t0, t1, tt); #end #end interpolacao #end #macro busca_quadro(tt, n, tQ) #local fqq = 0; #for (q, 1, n - 1, 1) #if (tQ[q - 1] < tt & tt < tQ[q]) #declare fqq = q - 1; #end #end fqq #end #declare A0 = array[6][4] { { 71, -68, -45, 21 }, { -45, 25, -45, 12 }, { -12, -91, -15, 22 }, { 10, 13, -28, -12 }, { -25, -5, 30, -8 }, { -31, -3, -81, -29 } } #declare A1 = array[6][4] { { 56, -26, -62, 13 }, { -60, 21, -60, 7 }, { -12, -71, -15, 22 }, { 17, 13, -13, -7 }, { -19, -11, 28, -17 }, { -23, -3, -87, -23 } } #declare A2 = array[6][4] { { 4, -17, -35, 13 }, { -60, 21, -15, 0 }, { -4, -56, 40, 34 }, { 55, 2, -38, -7 }, { -29, -10, 19, -31 }, { -31, 12, -69, -23 } } #declare A3 = array[6][4] { { 47, -17, 0, 38 }, { -60, 9, -15, 0 }, { -4, -43, 40, -10 }, { 80, 2, -38, 43 }, { -66, -10, 8, -31 }, { 1, 83, -93, -23 } } #declare A4 = array[6][4] { { 32, -15, -35, -4 }, { -50, 33, -15, -12 }, { -20, -57, 29, 44 }, { 25, 35, -49, 3 }, { -15, 14, 30, -15 }, { -42, 12, -52, -33 } } #declare A5 = array[6][4] { { 56, -26, -62, 13 }, { -60, 21, -60, 7 }, { -12, -71, -15, 22 }, { 17, 13, -13, -7 }, { -19, -11, 28, -17 }, { -23, -3, -87, -23 } } #declare Q = array[6] { A0, A1, A2, A3, A4, A5 } #declare tQ = array[6] { 0, 0.2, 0.4, 0.6, 0.8, 1 } #declare iQ = busca_quadro(clock, 6, tQ); #declare QQ = interpola_quadros(6, 4, Q, iQ, tQ[iQ], iQ + 1, tQ[iQ + 1], clock); dragao(<0, 0, 0>, QQ)