| 1 |
% pixelgrid.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2001 |
| 4 |
|
| 5 |
%input mp-tool; |
| 6 |
path fullsquare; |
| 7 |
fullsquare := unitsquare shifted - center unitsquare ; |
| 8 |
|
| 9 |
beginfig(1); |
| 10 |
numeric u, ix, iy, s, h, v, i, j, n, f, r, l; |
| 11 |
numeric last, angl, hori; |
| 12 |
path frame; |
| 13 |
pair cpos; |
| 14 |
u = 2mm; |
| 15 |
s = 1.2u; |
| 16 |
n = 1; % 6 |
| 17 |
f = 30; % 5 |
| 18 |
h = f*n; |
| 19 |
v = ceiling(h/sqrt(2)); |
| 20 |
frame = fullsquare scaled 1u; |
| 21 |
% for ix=0 upto h: |
| 22 |
% for iy=-v upto v: |
| 23 |
% draw frame shifted (ix*s,iy*s); |
| 24 |
% endfor; |
| 25 |
% endfor; |
| 26 |
filldraw frame; |
| 27 |
for i=1 upto n: |
| 28 |
r := i*f; |
| 29 |
l := round(r/sqrt(2)); |
| 30 |
last := 0; |
| 31 |
for j=0 upto l: |
| 32 |
hori := round(sqrt(r*r-j*j)); |
| 33 |
cpos := (hori*s,j*s); |
| 34 |
angl := angle(cpos); |
| 35 |
filldraw frame shifted cpos; |
| 36 |
show angl-last; |
| 37 |
last := angl; |
| 38 |
% draw origin--cpos; |
| 39 |
endfor; |
| 40 |
endfor; |
| 41 |
% draw fullcircle scaled (2*r*s) withcolor red; |
| 42 |
% draw boundingbox currentpicture; |
| 43 |
endfig; |
| 44 |
|
| 45 |
end; |