diff options
Diffstat (limited to 'Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf')
-rw-r--r-- | Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf new file mode 100644 index 00000000000..29d370d8ee6 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf @@ -0,0 +1,32 @@ +%%%% +%%%% 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 |