[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: ATM Homemade Ronchi Grating! It Works!
On Wed, 4 Jun 1997, Dr. Marcus Hennecke wrote:
>
>And finally, for those of us without CAD programs, here is a little
>Postscript file that prints out a 100 lines per inch grating. You can
>easily adjust the parameters in any text editor.
>
>Marcus
>
.....
[from a Ronchi-impaired PostScript hacker:] Note that parallel lines in
PostScript are subject to inconsistent widths and spacing, whose visual
severity depends on the output device's resolution. At 600 dpi, Dr.
Hennecke's PostScript code will probably work fine, but at 300 dpi (common)
or lower (e.g. running GhostScript on a computer monitor or dot-matrix
printer), the inconsistencies will probably be noticeable. Here is a
slightly modified version of the original which rounds-off linewidth and
spacing so that it aligns perfectly with output device resolution: (I
wonder if CAD programs and others of that ilk do this kind of thing.)
_________________________________________________________________________
%!PS-Adobe-1.0
%%Creator: Marcus E. Hennecke, June 4, 1997, alt. M.Read %%
%%EndComments
% Define some length units
/inch { 72 mul } def
/cm { 28.346457 mul } def
% Define operation to align values to device's (integer) X coordinates %%
/massageX { 0 dtransform round exch round exch idtransform pop } def %%
% Leave a margin
1 inch 1 inch translate
% Grid size
/Width 6.5 inch def
/Height 9 inch def
% Number of grid lines per inch
/Grid 100 def
% Relative line thickness (less than .5: lines thinner than blanks)
/Thickness .5 def
% Draw the grid
/dx 1 inch Grid div def
dx Thickness mul massageX setlinewidth % linewidth in device "pixels" %%
/dx dx massageX def % adjust inter-line gap %%
0 dx Width {
newpath
0 moveto
0 Height rlineto
stroke
} for
showpage
_________________________________________________________________________
(The five lines I changed are marked with "%%" in the right columns.)
The only problem with this version is that we have sacrificed precision for
accuracy (or the other way around, depending on your definitions), i.e. our
lines are now nice and even, but they might not be exactly 100 per inch. I
supppose it would be no worse than 99 or 101, depending on your machine, but
it likely will not be 100.0000...
Anyway, a question for the Ronchi-experts: which is more important,
consistent line-widths and spacing, or precise lines per inch?
- Matt
--
<MattRead><mread@hns.com><619.452.4608><HughesNetworkSystems,SanDiego,CA>