I am trying to anime a pump but itn't working. I need help. Thank you.
restart;
with(plots);
with(plottools);
unprotect(D);
alpha := arctan(-58/62.5);
solve({k*Pi/100 = alpha}, {k});
beta := arctan(19/84);
solve({k*Pi/100 = beta}, {k});
ang1 := arctan(-68/84);
evalf(solve({k = ang1}, {k}));
ang2 := arctan(55/84);
evalf(solve({k = ang2}, {k}));
#angular head travel
Head := proc(k) local r, poly, k1, tC, tD, tE, DikC, DikD, DikE;
global C, D, E; r := 84;
C := [-55, 17]; D := [0, 0]; E := [84, 0];
poly := [[-60, 24], [63, -17], [60, -55.5], seq([r*cos(1/100*k*Pi), r*sin(1/100*k*Pi)], k1 = -24 .. 7), [82, 18], [78, 20], [64, -3], [-46.5, 35]];
tC := textplot([C[], "C"], align = {above, right}, font = [Times, bold, 18]);
tD := textplot([D[], "D"], align = {above, left}, font = [Times, bold, 18]);
tE := textplot([E[], "E"], align = {above, left}, font = [Times, bold, 18]);
DikC := disk(C, 1, color = black);
DikD := disk(D, 1, color = black);
DikE := disk(E, 1, color = black);
if 0 <= k and k <= 0.579 then display(polygon(poly, color = yellow), tC, tD, tE, DikC, DikD, DikE, scaling = constrained); rotate(%, k, D);
elif -0.68 <= k and k <= 0 then display(polygon(poly, color = yellow), tC, tD, tE, DikC, DikD, DikE, scaling = constrained); rotate(%, k, D); end if;
end proc;
Head(0.3);
Crankpin := proc(alpha) local poly, DikA, DikB, tA, tB, PG;
global A, B;
poly := [[-8, 6], [-7, 20], [-6, 38], [6, 38], [7, 20], [8, 6], [-10, 6], [-16, 6], [-25, 0], [-17, -8], [-8, -8], [-8, -17], [8, -17], [8, -8], [17, -8], [25, 0], [16, 6]]; A := [-60, -62]; B := [-60, -40];
tA := textplot([A[], "A"], align = {above, right}, font = [Times, bold, 18]);
tB := textplot([B[], "B"], align = {above, left}, font = [Times, bold, 18]);
PG := polygon(poly, color = green);
DikA := disk(A, 1, color = black);
DikB := disk(B, 1, color = black);
display(translate(PG, -60, -62), DikA, DikB, tA, tB, scaling = constrained); rotate(%, alpha, A, B); end proc;
Rod := proc()
local BC;
global B, C;
BC := plot([B, C], color = red, thickness = 8);
display(BC, scaling = constrained); end proc;
Fig := proc(alpha)
local DikA, DikB;
global A, B;
A := [-60, -62]; B := [-60, -40];
DikA := disk(A, 1, color = black);
DikB := disk(B, 1, color = black);
display([Head(0.3), Rod(), DikA, DikB, Crankpin(alpha)], scaling = constrained);
end proc;
nframes := 100:
frames := seq(Fig(2*Pi*n/nframes), n=1..nframes):
plots:-display(frames, insequence):