%%%%
%%%% This file belongs to the MFTOEPS package.
%%%%
% ---
% POLYGONS.MF
% ---
vardef regular_polygon(expr n) =
% |n| is the number of vertices; the diameter of the circumscribed circle
% is equal to 1, its center is in the origin
(up % first vertex
for i:=1 upto n-1:
-- (up rotated (i*(360/n))) % next vertices
endfor
-- cycle) scaled .5
enddef;
vardef flex_polygon(expr n,a,b) =
% |n| is the number of vertices, |a|, |b| are the angles (at vertices)
% between a tangent to a ``flex side'' and the corresponding secant
save zz; pair zz[ ]; % array of vertices
for i:=0 upto n-1:
zz[i]:=up rotated (i*(360/n));
endfor
(zz[0] {(zz[1]-zz[0]) rotated a}
for i:=1 upto n-1:
.. {(zz[i]-zz[i-1]) rotated b}
zz[i]
{(zz[(i+1) mod n]-zz[i]) rotated a}
endfor
.. {(zz[0]-zz[n-1]) rotated b} cycle)
scaled .5
enddef;
endinput