🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #2685

Re: Re^2: hex paper

#2685
From: Calvin Clark
Date: Wed, 01 Aug 1990 03:10
104 lines
3418 bytes
Here is a hex paper generator which allows you to set the
size of the hexes and the (rectangular) bounding margins on the paper.
Enjoy.

It is short, so I thought I'd just post directly:

%!   PostScript Hex Paper Maker
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                     %
%  H   H EEEEE X   X     PPPPP SSSSS  %
%  H   H E      X X      P   P S      %
%  HHHHH EEE     X       PPPPP SSSSS  %
%  H   H E      X X      P         S  %
%  H   H EEEEE X   X  %  P     SSSSS  %
%                                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                     %
% BY CALVIN CLARK (1990)              %
%                                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/inch {72 mul} def
/SQRT3 1.73205 def

%%%% Things for you to set %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/TM 0.5 inch def        % MARGINS IN WHICH TO FIT THE HEX PATTERNS 
/BM 0.5 inch def
/RM 0.5 inch def
/LM 0.5 inch def 

/PGWIDTH  8.5 inch def  % PAGE SIZE 
/PGHEIGHT 11 inch def

/SIDELEN 0.3 inch def		  % LENGTH OF SIDE OF A HEXAGON
/THICKNESS {SIDELEN 0.01 mul} def % THICKNESS OF LINES 
			
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Calculate number of columns:

/NCOLS {PGWIDTH RM sub LM sub SIDELEN 1.5 mul div cvi} def 

% Calculate number of rows:

/NROWS {PGHEIGHT TM sub LM sub SIDELEN SQRT3 mul div cvi} def 

/N {NCOLS 1 sub 2 div cvi} def  % 2N+1 =  # columns produced (always odd) 

/SQUIGLINE1 {
	newpath
	0 0 moveto
	60 rotate
	1 0 rlineto
	N {
		2 {-60 rotate 1 0 rlineto} repeat
		2 { 60 rotate 1 0 rlineto} repeat
	} repeat
	2 {-60 rotate 1 0 rlineto} repeat
	60 rotate
	stroke
} def

/SQUIGLINE2 {
	newpath
	0 0 moveto
	-60 rotate
	1 0 rlineto
	N {
		2 { 60 rotate 1 0 rlineto} repeat
		2 {-60 rotate 1 0 rlineto} repeat
	} repeat
	2 {60 rotate 1 0 rlineto} repeat
	-60 rotate
	stroke
} def

/drawlines {
	NROWS {
		SQUIGLINE1
		SQUIGLINE2
		0 SQRT3 neg translate
	} repeat
} def

LM PGHEIGHT TM sub SIDELEN SQRT3 mul 2 div sub translate
SIDELEN SIDELEN scale
THICKNESS SIDELEN div setlinewidth

drawlines

showpage



The Hammer

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INTERNET E-MAIL:                   %  Calvin Clark                    %
% PLAY: ckclark@athena.mit.edu       %  279 Harvard Street, Apt. #31    %
% WORK: clark@radmed.mgh.harvard.edu %  Cambridge, MA 02139             %
%                                    %  (617) 864-3857                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Technical Details
Message-ID: <1990Aug1.031024.18026@athena.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!athena.mit.edu!ckclark
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> <1990Jul27.103908.23182@cs.umu.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!athena.mit.edu!ckclark
From: ckclark@athena.mit.edu (Calvin Clark)
Newsgroups: comp.lang.postscript
Subject: Re: Re^2: hex paper
Keywords: hex paper
Message-ID: <1990Aug1.031024.18026@athena.mit.edu>
Date: 1 Aug 90 03:10:24 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> <1990Jul27.103908.23182@cs.umu.se>
Sender: daemon@athena.mit.edu (Mr Background)
Reply-To: ckclark@athena.mit.edu (Calvin Clark)
Organization: Massachusetts Institute of Technology
Lines: 104