summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-04-16 22:46:29 +0000
committerKarl Berry <karl@freefriends.org>2012-04-16 22:46:29 +0000
commit76e16dc8afcc19ccbb1cc66be529411dfe41ce6e (patch)
tree5e79f4db9f36c7e53887264b98bf3b33d41daa5f /Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp
parent9d51929278483d4f1cbfe10dee38085f3ca4811c (diff)
featpost (16apr12)
git-svn-id: svn://tug.org/texlive/trunk@25991 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp')
-rw-r--r--Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp45
1 files changed, 45 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp b/Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp
new file mode 100644
index 00000000000..e6a1418485b
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/featpost/example/pixelgrid.mp
@@ -0,0 +1,45 @@
+% pixelgrid.mp
+% L. Nobre G.
+% 2001
+
+%input mp-tool;
+path fullsquare;
+fullsquare := unitsquare shifted - center unitsquare ;
+
+beginfig(1);
+ numeric u, ix, iy, s, h, v, i, j, n, f, r, l;
+ numeric last, angl, hori;
+ path frame;
+ pair cpos;
+ u = 2mm;
+ s = 1.2u;
+ n = 1; % 6
+ f = 30; % 5
+ h = f*n;
+ v = ceiling(h/sqrt(2));
+ frame = fullsquare scaled 1u;
+% for ix=0 upto h:
+% for iy=-v upto v:
+% draw frame shifted (ix*s,iy*s);
+% endfor;
+% endfor;
+ filldraw frame;
+ for i=1 upto n:
+ r := i*f;
+ l := round(r/sqrt(2));
+ last := 0;
+ for j=0 upto l:
+ hori := round(sqrt(r*r-j*j));
+ cpos := (hori*s,j*s);
+ angl := angle(cpos);
+ filldraw frame shifted cpos;
+ show angl-last;
+ last := angl;
+% draw origin--cpos;
+ endfor;
+ endfor;
+% draw fullcircle scaled (2*r*s) withcolor red;
+% draw boundingbox currentpicture;
+endfig;
+
+end;