🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #2638

Re: Re^2: hex paper

#2638
From: Christer Ericson
Date: Fri, 27 Jul 1990 10:39
92 lines
3235 bytes
In article <1990Jul26.150234.23258@acc.stolaf.edu> danjudd@dagon.stolaf.edu (Dan Judd) writes:
>In article <38413@sequent.UUCP> rjk@sequent.UUCP (Robert Kelley) writes:
>>I don't know what the referenced articles are about, but maybe someone here can supply Postscript
>>code to generate open hexagonal grids (like honeycombs), i.e. "Hex Paper".  Code appreciated!
>>
>>xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) writes:
>>
>
>I keep a small archive of ftpable postscript utilities, pics etc
>they are available from nic.stolaf.edu (130.71.128.8) in /pub/ps.
>There are a couple of hex paper generaters, mostly for rpg's, but
>they could be used for what ever you want. 
>
> [...]
>
>Dan Judd
>danjudd@acc.stolaf.edu
>

Well, here's another hex map generator that you can add to your archive. I
wrote this last year when someone on rec.games.board requested a hex map
generator, it's a quick hack, but it works. It could be improved by, for
instance, making it figure out the height and width factors from the page
size), but I felt it wasn't really worth the effort.


----- cut here -----
%!
% Simple Hex Map Generator
% Copyright (c) Christer Ericson, 1989-10-10.
% Dept. of Computer Science, University of Umea, Sweden.
% Internet: christer@cs.umu.se
%

initgraphics

% ==== variables ===

/len 20 def          % determines the size of the hex (length of its sides)
/height 22 def       % specifies number of hexes (0101-wwhh)
/width 17 def
/fontsize 10 def     % change this to go along with the specified 'len'
/donumbers true def  % print coordinates in each hex (standard numbering)

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

/Times-Roman findfont fontsize scalefont setfont
/astr 3 string def

/print {
  dup 10 idiv astr cvs show
  10 mod astr cvs show
} def

/hex {
  /col exch def
  1 1 10 {
    pop
    len 0 rlineto
    60 rotate
  } for
  120 rotate
  donumbers {gsave 0 0 fontsize sub rmoveto row print col print grestore} if
} def

/lineofhex {
  gsave
  height -1 1 {
    hex
  } for
  stroke
  grestore
} def

0 setlinewidth
40 40 moveto
/row 1 def
1 1 width {
  lineofhex
  row 2 mod 1 eq
    {len 0 rlineto 300 rotate len 0 rlineto 60 rotate}
    {len 0 rlineto 60 rotate len 0 rlineto 300 rotate}
  ifelse
  /row row 1 add def
} for

showpage
----- cut here too -----

| Christer Ericson            Internet: christer@cs.umu.se [130.239.1.101] |
| Department of Computer Science, University of Umea, S-90187 UMEA, Sweden |
|                            "I bully sheep. I claim God doesn't exist..." |
Technical Details
Message-ID: <1990Jul27.103908.23182@cs.umu.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!uupsi!sunic!cs.umu.se!christer
References: <1990Jul9.201615.7589@penfold.gryphon.com> <1990Jul10.073332.23339@cs.umn.edu> <1990Jul11.045712.6426@zorch.SF-Bay.ORG> <38413@sequent.UUCP> <1990Jul26.150234.23258@acc.stolaf.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!uupsi!sunic!cs.umu.se!christer
From: christer@cs.umu.se (Christer Ericson)
Newsgroups: comp.lang.postscript
Subject: Re: Re^2: hex paper
Message-ID: <1990Jul27.103908.23182@cs.umu.se>
Date: 27 Jul 90 10:39:08 GMT
References: <1990Jul9.201615.7589@penfold.gryphon.com> <1990Jul10.073332.23339@cs.umn.edu> <1990Jul11.045712.6426@zorch.SF-Bay.ORG> <38413@sequent.UUCP> <1990Jul26.150234.23258@acc.stolaf.edu>
Sender: news@cs.umu.se (News Administrator)
Reply-To: christer@cs.umu.se (Christer Ericson)
Organization: Dep. of Info.Proc, Umea Univ., Sweden
Lines: 92