From: toms@pdxgp1.intel.com (Tom Shott)
Subject: Re: Program to Print Hexagon Maps
Organization: /fs3/l/toms/.organization
Distribution: rec
Date: Thu, 13 Aug 1992 07:00:42 GMT


I didn't write this and am not sure who did but read the credits.
It works great but you may need to adjust the values for the size you want.

Just proves I have been reading news too long and keep too much.

------------------------------------------------------------------------------
Tom Shott  INTeL, JF1-19, 5200 Elam Young Pkwy, 		(503) 696-4520
	   Hillsboro, OR 97124  		   	 toms@ichips.intel.com
 INTeL.. We brought you segments,432,EPROM,CISC,RISC,VLIW,EISA,DRAM,FLASH



%!  for use by dvi2ps Version 2.00 % $Header: tex.ps,v 2.0 88/06/07
15:12:32 peterd Rel2 $ % HEXSET.PS, CHOINSKI>TEXT, Performance Tools,
03/08/89 % Prints hex sheets with larger surrounding hexes.  % Description:
% This POSTSCRIPT program will print hex sheets that look like this: % %
____//====================\\ ______ ______ // % / // \ / \ \\ / \ / \ /// %
/ // \______/ \____\\/ \______/ \____/// % \ // / \ / \\ / \ / // \ %
\//____/ \______/ \\______/ \______/ // \ % // \ / \ \\ \ / \ // / % //
\______/ \______/ \\ \______/ \//____/ % XX / \ / \
XX====================XX \ % \\______/ \______/ \//____/ \______/ \\ \ % \\
\ / \ // \ / \ \\ / % / \\ \______/ \______// \______/ \__\\__/ % \ \\ / \
/ // / \ / \\ \ % \__\\__/ \______/ // \______/ \______/ \\ \ % / \\ \ / \
// / \ / \ \\/ % / XX====================XX__/ \______/ \______XX % \ // /
\ / \\ \ / \ / // % \__//__/ \______/ \\ \______/ \______/ // \ % / // \ /
\ \\/ \ / \ // / % / // \______/ \______\\ \______/ \__//__/ % \// / \ /
\\\ / \ / // \ % //______/ \______/ \\\____/ \______/ // \ % XX/ \ / \ /
XX====================XX / % \\ \______/ \______/ // \______/ \\\____/ %
\\\ / \ / \// / \ / \\ \ % \\\____/ \______/ //______/ \______/ \\ \ % / \\
\ / \ /// \ / \ \\ / % / \\ \______/ \____/// \______/ \____\\/ % \ \\ / \
/ // \ / \ / \\ % \____XX====================XX \______/ \______/ XX % / //
\ / \ \\ / \ / \ /// % / // \______/ \____\\/ \______/ \____/// % \ // / \
/ \\ / \ / // \ % \//____/ \______/ \\______/ \______/ // \ % // \ / \ \\ \
/ \ // / % // \______/ \______/ \\ \______/ \//____/ % // / \ / \
\\====================// \ % \______/ \______/ \______/ \______/ \ % %
Although, a lot neater and with the hexes lining up better!  % % Abnormal
conditions: % % None that I know of, but that doesn't mean there isn't any.
I have not % tried to use non-integer fill or scale values, nor did I see
the need % to produce such sheets, therefore this program may blow up if
you try % to do so.  % % Implementation: % % Standard Adobe Postscript.
This does not include any set-up code required % by your printer (our
spooler handles this stuff).  % % Basically, the FILL variable defines how
many small hexes can fit from % side to side in the large hexes.  In the
above example, the FILL would % be about 3 (it looks like 3.5).  The FILL
variable should be an integer % value (2+).  % % The SCALE variable
determines how many strips of large hexes are to be % printed.  The above
example is SCALE = 1.  A SCALE of 2 would print 4 % rows of big hexes
instead of just 2.  % % YMAX and XMAX are set to the paper size in points
(72 pt per inch).  % If your printer uses larger paper, these should be
changed.  Current % settings reflect 8.5x11 paper.  %
%==============================================================================
% NOTES: % % This program can be used to create simple hex paper as well as
% hex-within-hex paper.  Simply use a FILL value of 1.  % % Usefull
settings: % FILL 10, SCALE 2+: Tactical maps for 2300ad or Space: 1889 %
FILL 20, SCALE 1: AD&D, 20 mile per hex maps.  % FILL 1, SCALE 1+: Single
hex layer hex sheets.  % FILL 1, SCALE 8: ~15mm hexes % % Modifications: %
Date Programmer Description of modification % 03/08/89 Choinski Initial
coding.

%==============================================================================
%_______Key Definitions!  These must be decided for sheet appearance!_________%
/fill  5 def    % small hexes width per large hex
/scale 3 def    % # of large hex double strips

/ymax  11  72 mul def   % Height of paper, in points
/xmax  8.5 72 mul def   % Width of paper, in points

%==============================================================================

/hexes fill 1 add 3 div cvi fill 2 mul scale mul add def
/double hexes 2 div cvi def
/single hexes 2 mod def
/range 0.931 xmax mul hexes 3 mul 1 add div 2 mul fill mul def

/top fill 2 mod def
/s60 60 sin def

%==============================================================================

/hex {
  newpath
  0 0 moveto
  len 0 lineto
  len 1.5 mul height lineto
  len height 2 mul lineto
  0 height 2 mul lineto
  0.5 len mul neg height lineto
  0 0 lineto
  stroke
  } def

/hex2 {
  newpath
  0 0 moveto
  len 0 lineto
  len 1.5 mul height lineto
  len height 2 mul lineto
  0 height 2 mul lineto
  0.5 len mul neg height lineto
  0 0 lineto
  0.5 len mul neg height neg lineto
  stroke
  0 0 moveto
  } def

/hex3 {
  newpath
  0 0 moveto
  len 0 lineto
  len 1.5 mul height lineto
  len height 2 mul lineto
  len 1.5 mul height 3 mul lineto
  len height 2 mul lineto
  0 height 2 mul lineto
  0.5 len mul neg height lineto
  0 0 lineto
  stroke
  } def

/hexline1 {
gsave
2 fill mul scale mul fill 2 div add cvi top add 1 sub
  { hex
    0 height 2 mul translate
  } repeat
grestore
} def

/hexline2 {
gsave
2 fill mul scale mul fill 2 div add cvi
  { hex
    0 height 2 mul translate
  } repeat
grestore
} def

/hexline3 {
gsave
2 scale mul
  { hex2
    0 height 2 mul translate
  } repeat
grestore
} def

/hexline4 {
gsave
2 scale mul
  { hex3
    0 height 2 mul translate
  } repeat
grestore
} def

/hexpage1 {
double
  {
    0 0 moveto
    0 height translate
    hexline1
    0 0 moveto
    1.5 len mul height neg translate
    hexline2
    1.5 len mul 0 translate
  } repeat
single
  { 0 0 moveto
    0 height translate
    hexline1
  } repeat
} def

/hexpage2 {
1 scale mul
  {
  0 0 moveto
  0 height translate
  hexline3
  0 0 moveto
  1.5 len mul height neg translate
  hexline4
  1.5 len mul 0 translate
  } repeat
} def

/yoffset ymax range s60 mul scale 4 mul 1 add mul sub 2 div def
gsave
/len range fill div def
/height len s60 mul def
21 len 2 div add yoffset translate
1 setlinecap
0.40 setlinewidth
0.9 setgray
hexpage1
grestore

gsave
/len range def
/height len s60 mul def
21 len 2 div add yoffset translate
1 setlinecap
2.0 scale div setlinewidth
0.6 setgray
hexpage2
grestore
showpage

% End of program

--
------------------------------------------------------------------------------
Tom Shott  INTeL, JF1-19, 5200 Elam Young Pkwy, 		(503) 696-4520
	   Hillsboro, OR 97124  		   	 toms@ichips.intel.com
 INTeL.. We brought you segments,432,EPROM,CISC,RISC,VLIW,EISA,DRAM,FLASH
Newsgroups: rec.games.design