rjk@sequent.UUCP (Robert Kelley) (07/12/90)
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: >sandvig@poincare.geom.umn.edu (Cary Sandvig) writes: >>we were doing hyperbolic geometry with it last summer... >>then later on working out configurations for a crystal growth simulator... >You really ought to go back to that occult shop and buy the directions >that go with hex paper; trust me on this, you're using it completely >wrong. >Kent, the man from xanth. ><xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us> >-- >Sitting at the console all day, watching the news scroll away -- James Deibele
xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (07/12/90)
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: > >>sandvig@poincare.geom.umn.edu (Cary Sandvig) writes: >>>we were doing hyperbolic geometry with it last summer... >>>then later on working out configurations for a crystal growth simulator... > >>You really ought to go back to that occult shop and buy the directions >>that go with hex paper; trust me on this, you're using it completely >>wrong. We here at talk.bizarre posting central rarely get a call to post source code. Naturally, when that call comes, every loyal bizarrite does his/her duty. It is of course mandatory to post source code that can in no way be used for the purpose described in the request, and that is as bizarre as possible. So, no (bleah!) Postscript. No (bletch) 'C'. Nothing at all useful. Here is _LINEPRINTER_ hex grid code in _FORTRAN 77_ for BSD 4.3 Unix. It trys to tell the story of the founding of talk.bizarre back in the days of the old west. If you take out one lousy and well annotated GOTO(considered harmful) it becomes a hex maze generator program. Suck rocks and die before you ask for help bringing this up. I never saw this code before in my life. Kent, the man from xanth, who can write FORTRAN code in any language, but prefers the real thing. <xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us> -- Sitting at the console all day, watching the news scroll away -- James Deibele #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # bighexgrid.f # This archive created: Thu Jul 12 01:17:53 1990 export PATH; PATH=/bin:$PATH echo shar: extracting "'bighexgrid.f'" '(7542 characters)' if test -f 'bighexgrid.f' then echo shar: will not over-write existing file "'bighexgrid.f'" else sed 's/^XX//' << \SHAR_EOF > 'bighexgrid.f' XXC--------------------------------------------------- XXC PROGRAM MAZE XXC--------------------------------------------------- XX PROGRAM MAZE XXC Column, row order for drawing characters: XX CHARACTER*1 MAZEC (129,62) XXC XXC Same for logical maze: XXC XXC Sized to correspond to printout size: XX CHARACTER*1 MAZEL (32,60) XXC XXC About double the needed size frontier list: XX INTEGER FLIST (4000),KFLST,MFLST XXC Markers for external, internal, and frontier maze elements: XX CHARACTER*1 EXTER,INTER,FRONT XXC Counters for cells in each condition: XX INTEGER KEXTR,KINTR,KFRNT XXC Characters for drawing maze: XX CHARACTER*1 BLANK,UNDER,SLASH,BACKS XXC Give maze sizes names, to make them easy to change: XX INTEGER ROWC,COLC,ROWL,COLL XXC Look up tables for maze offsets. Sense of index is 1/2 the XXC clock hour which points at the neighbor! XX INTEGER IOFFC(6),JOFFC(6),IOFFL(6),JOFFL(6) XXC Arrays for storing the output of the system clock routines: XX INTEGER DBUF(3),TBUF(3) XXC XX LOGICAL EXIST XXC Cell condition markers: XX DATA EXTER / 'E' /, XX 1 INTER / 'I' /, XX 2 FRONT / 'F' / XXC Maze drawing pieces: XX DATA BLANK / ' ' /, XX 1 UNDER / '_' /, XX 2 SLASH / '/' /, XX 3 BACKS / '\\' / XXC Maze sizes: XX DATA ROWC / 62 /, XX 1 COLC / 129 /, XX 2 ROWL / 60 /, XX 3 COLL / 32 / XXC Size of FLIST XX DATA MFLST / 4000 / XXC Character maze offsets to border picture elements: XXC 2 4 6 8 10 12 clock directions. XX DATA IOFFC / +1, +1, +0, -1, -1, +0 / XX DATA JOFFC / +1, +2, +2, +2, +1, +0 / XXC Logical maze offsets to neighbors: XXC 2 4 6 8 10 12 clock directions. XX DATA IOFFL / +1, +1, +0, +0, +0, +0 / XX DATA JOFFL / -1, +1, +2, +1, -1, -2 / XXC Inline functions for the offsets: XX ICOFF ( IIN,JIN,NCLOK ) = ( 4*IIN ) + IOFFC(NCLOK) -2 * MOD(JIN,2) XX JCOFF ( IIN,JIN,NCLOK ) = JIN + JOFFC(NCLOK) XX ILOFF ( IIN,JIN,NCLOK ) = IIN + IOFFL(NCLOK) XX 1 - MOD(JIN,2) + ( MOD(JOFFL(NCLOK)+3,2)*MOD(JIN,2) ) XX JLOFF ( IIN,JIN,NCLOK ) = JIN + JOFFL(NCLOK) XXC Inline function for real random to integer choice conversion: XX IDORN(IBEG,IEND) = XX 1 MIN(IFIX(FLOAT(IEND-IBEG+1)*DRAND(0))+IBEG,IEND) XXC Inline function to check existance of a neighbor: XX EXIST(IIN,JIN) = ( ( ( IIN.GE.1 ) .AND. XX 1 ( IIN.LE.COLL ) ) .AND. XX 2 ( ( JIN.GE.1 ) .AND. XX 3 ( JIN.LE.ROWL ) ) ) XXC Inline function to pack coordinates for the frontier list: XX IFPCK(IIN,JIN) = ((JIN-1)*COLL+IIN-1) XXC Inline functions to unpack coordinates from the frontier list: XX IUNPK(IFIN) = MOD(IFIN,COLL) + 1 XX JUNPK(IFIN) = (IFIN/COLL) + 1 XXC Seed random number generator: XX CALL IDATE(DBUF) XX CALL ITIME(TBUF) XX NSEED = XX &((((DBUF(2))*31+DBUF(3))*24+TBUF(1))*60+TBUF(2))*60+TBUF(3) XX RJUNK = DRAND(ISEED) XXC Blank maze drawing: XX DO 2 IC = 1,COLC XX DO 1 JC = 1,ROWC XX MAZEC(IC,JC) = BLANK XX 1 CONTINUE XX 2 CONTINUE XXC Mark all maze cells exterior: XX DO 4 IL = 1,COLL XX DO 3 JL = 1,ROWL XX MAZEL(IL,JL) = EXTER XX 3 CONTINUE XX 4 CONTINUE XXC Tile maze drawing: XXC First row is special: XX DO 5 IC = 2,COLC,4 XX MAZEC(IC,1) = UNDER XX 5 CONTINUE XXC Do rest of odd rows: XX DO 7 JC = 3,ROWC,2 XX DO 6 IC = 1,COLC XX IF (MOD(IC,4).EQ.1) MAZEC(IC,JC) = BACKS XX IF (MOD(IC,4).EQ.2) MAZEC(IC,JC) = UNDER XX IF (MOD(IC,4).EQ.3) MAZEC(IC,JC) = SLASH XXC IF (MOD(IC,4).EQ.0) MAZEC(IC,JC) = BLANK Leave it blank. XX 6 CONTINUE XX 7 CONTINUE XXC Do even rows: XX DO 9 JC = 2,ROWC,2 XX DO 8 IC = 1,COLC XX IF (MOD(IC,4).EQ.1) MAZEC(IC,JC) = SLASH XXC IF (MOD(IC,4).EQ.2) MAZEC(IC,JC) = BLANK Leave it blank. XX IF (MOD(IC,4).EQ.3) MAZEC(IC,JC) = BACKS XX IF (MOD(IC,4).EQ.0) MAZEC(IC,JC) = UNDER XX 8 CONTINUE XX 9 CONTINUE XXC Fix two special cases, upper right and lower left: XXC (May need a patch if changed row, column limits change XXC edge conditions.) XX MAZEC(COLC,2) = BLANK XX MAZEC(1,ROWC) = BLANK XXC Clear frontier list: XX KFLST=0 XXC Set up cell condition counters: XX KEXTR=COLL*ROWL XX KINTR=0 XX KFRNT=0 XXC XXC Seed maze: XXC XXC Find a likely prospect: XX ILNEW = IDORN(1,COLL) XX JLNEW = IDORN(1,ROWL) XXC Serve him a warrent: XX MAZEL (ILNEW,JLNEW) = INTER XXC Housekeep the counters: XX KINTR = KINTR + 1 XX KEXTR = KEXTR - 1 XXC XXC This is a cook; modify normal program to just make some hex grids; XXC bypass all other processing: XXC XX GO TO 50 XXC XXC Design maze: XXC XX 10 CONTINUE XXC Check out the neighborhood: XX DO 11 MCLOK = 1,6 XXC Make the address of the neighbor in MCLOK direction: XX IL = ILOFF(ILNEW,JLNEW,MCLOK) XX JL = JLOFF(ILNEW,JLNEW,MCLOK) XXC Make sure there's someone home: XX IF (.NOT.EXIST(IL,JL)) GO TO 11 XXC Make sure he's a customer: XX IF (.NOT.(MAZEL(IL,JL).EQ.EXTER)) GO TO 11 XXC Enter him in the raffle: XX KFLST = KFLST + 1 XXC (Check first that we didn't sell too many tickets:) XX IF (KFLST.GT.MFLST) GO TO 9999 XX FLIST(KFLST) = IFPCK(IL,JL) XXC Housekeep the counters: XX KFRNT = KFRNT + 1 XX KEXTR = KEXTR - 1 XXC And send him a note to let him know: XX MAZEL(IL,JL) = FRONT XX 11 CONTINUE XXC We're done when we've destroyed the last frontier: XX IF (KFLST.EQ.0) GO TO 50 XXC Still a herd of buffalo running loose; pick one to shoot: XX IFNEW = IDORN(1,KFLST) XXC Find out his name, religious preference, burial request: XX IFNAM = FLIST(IFNEW) XX ILNEW = IUNPK(IFNAM) XX JLNEW = JUNPK(IFNAM) XXC Shoot the wooly bugger, another one runs to take his place: XX FLIST(IFNEW) = FLIST(KFLST) XXC Memo the bad news, another noble beast just bit the dust: XX KFLST = KFLST - 1 XX KFRNT = KFRNT - 1 XXC Find somebody to sell the carcass to; first, count the house: XX KNGBH = 0 XXC Look all around carefully for a live customer: XX DO 12 MCLOK = 1,6 XXC Choose a place to check: XX IL = ILOFF(ILNEW,JLNEW,MCLOK) XX JL = JLOFF(ILNEW,JLNEW,MCLOK) XXC Make sure there is such a place, not just another overdose of XXC snake oil: XX IF (.NOT.EXIST(IL,JL)) GO TO 12 XXC OK, there was one behind that rock, count him: XX IF (MAZEL(IL,JL).EQ.INTER) KNGBH = KNGBH + 1 XX 12 CONTINUE XXC We've counted them, now for the hard sell: XXC Pick a victim: XX NPICK = IDORN(1,KNGBH) XXC OOPS, he slipped away, but we know his face; find him again: XXC (Easier than building a callaboose to keep him in). XX DO 13 MCLOK = 1,6 XX IL = ILOFF(ILNEW,JLNEW,MCLOK) XX JL = JLOFF(ILNEW,JLNEW,MCLOK) XX IF (.NOT.EXIST(IL,JL)) GO TO 13 XX IF (MAZEL(IL,JL).NE.INTER) GO TO 13 XX NPICK = NPICK - 1 XXC This time we'll put the rock on him, so he's there when we need him: XX IF (NPICK.EQ.0) NCLCK = MCLOK XX 13 CONTINUE XXC Let's get his name, rank, service number and date of birth; he's a XXC slippery one. XX IC = ICOFF(ILNEW,JLNEW,NCLCK) XX JC = JCOFF(ILNEW,JLNEW,NCLCK) XXC Knock down the fence, we haven't got time to go around: XX MAZEC(IC,JC) = BLANK XXC Just one more dead buffalo: XX MAZEL(ILNEW,JLNEW) = INTER XXC Count him in: XX KINTR = KINTR + 1 XXC Do it again: XX GO TO 10 XXC XX 50 CONTINUE XXC Output the maze: XX WRITE (6,9001) ((MAZEC(IC,JC),IC=1,COLC),JC=1,ROWC) XXC XXC Size for line printer, for now: XX 9001 FORMAT (129A1) XX CALL EXIT(0) XXC XXC Blooper bailout: XXC XX 9999 WRITE (6,9902) XX 9902 FORMAT (" PROCESSING ERROR; ABORT.") XXC XX CALL EXIT(1) XX END SHAR_EOF if test 7542 -ne "`wc -c < 'bighexgrid.f'`" then echo shar: error transmitting "'bighexgrid.f'" '(should have been 7542 characters)' fi fi # end of overwriting check # End of shell archive exit 0
danjudd@thor.acc.stolaf.edu (Dan Judd) (07/26/90)
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. I need to add some things to the archive that I have picked up in the past month, and should be doing that next week sometime. If you have something you would like to add mail it to me. I am especially trying to build up a library of clip art (Freely Redistributeable of course) no bit maps please. Dan Judd danjudd@acc.stolaf.edu Just a Postscript kinda guy
christer@cs.umu.se (Christer Ericson) (07/27/90)
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..." |
ckclark@athena.mit.edu (Calvin Clark) (08/01/90)
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 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%