\startMPinclusions[+] vardef gear(expr x,y,r,n,d,t) = save m; for m=0 upto (n-1): draw ((subpath (0,2/n) of fullcircle)--(point (8/3/n) of (fullcircle scaled ((7+5*d)/12/d)))--(subpath (10/3/n,14/3/n) of (fullcircle scaled (1/d)))--(point (16/3/n) of (fullcircle scaled ((7+5*d)/12/d)))--(subpath (6/n,8/n) of fullcircle)) scaled (2*r) rotated t rotated (m/n*360) shifted (x,y); endfor; draw fullcircle scaled (3/2*r) shifted (x,y); draw fullcircle scaled r shifted (x,y); enddef; path q; q:=(-149,-43)--(62,-43)--(62,157)--(-149,157)--cycle; W:=ceiling(xpart urcorner q - xpart llcorner q)+1; % The width to pass to LaTeX H:=ceiling(ypart urcorner q - ypart llcorner q)+1; % The height to pass to LaTeX \stopMPinclusions \starttext \dorecurse{15}{ \startMPpage t:=\recurselevel-1; gear(0,0,36,16,0.875,360/96-24/16*t); gear(99*cosd(150)+0.5,99*sind(150)+0.5,54,24,0.875,t-3.2); gear(99*cosd(150)+109*cosd(30)+0.5,99*sind(150)+109*sind(30)+0.5,45,20,0.875,360/120-24/20*t+0.5); setbounds currentpicture to q; \stopMPpage } \stoptext