Article View: comp.lang.postscript
Article #6496Hexagonal Pattern
From: Arthur van Hoff
Date: Mon, 25 Jan 1993 12:34
Date: Mon, 25 Jan 1993 12:34
81 lines
2125 bytes
2125 bytes
Hi,
Here is a simple PdB program (the compiled PostScript is also
included) that draws an amazing hexagonal pattern resembling
that of the human retina.
Arthur van Hoff
************************
Start of the PdB program
************************
#include <graphics.h>
#define RADIUS 25 /* Radius of fovia */
#define CIRCLES 30 /* The number of circles */
#define SEGMENTS 64 /* Segments on each circle */
#define FACTOR1 1.05 /* Scaling factor */
#define FACTOR2 (FACTOR1 * 0.995)
void main()
{
float r1 = RADIUS, r2, r3;
int n, i;
clippath();
fill(1);
setgray(0);
translate(250,250);
for (n = 0 ; n < CIRCLES ; n++) {
r3 = r1;
r2 = r3 * FACTOR1;
r1 = r2 * FACTOR2;
for (i = 0 ; i < SEGMENTS ; i++) {
moveto(0,r1);
lineto(0,r2);
rotate(180 / SEGMENTS);
lineto(0,r3);
rotate(180 / SEGMENTS);
lineto(0,r2);
}
rotate(180 / SEGMENTS);
stroke();
}
}
extern "PostScript" {main};
************************
Verbatim compiler output
************************
/main {
% --
25 clippath 1 setgray fill 0 setgray 250 250 translate 30 {
dup 1.05 mul exch 1 index 1.04475 mul 3 1 roll 64 {
0 3 index moveto 0 2 index lineto 2.8125 rotate 0 1 index
lineto 2.8125 rotate 0 2 index lineto
} repeat
pop pop 2.8125 rotate stroke
} repeat
pop
} def
%begin postscript section
main
%end
--
Arthur van Hoff
The Turing Institute Limited
36 North Hanover Street,
G1 2AD Glasgow, Scotland
Tel: +44 41 552 8858 or +44 41 552 6400
Fax: +44 41 552 2985
Email: arthur@turing.com
The opinions expressed in this message are not
necessarily those of The Turing Institute Limited.
Technical Details
Message-ID:
<ARTHUR.93Jan25122827@lurch.turing.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!turing!coulin!arthurShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!turing!coulin!arthur From: arthur@turing.ac.uk (Arthur van Hoff) Newsgroups: comp.lang.postscript Subject: Hexagonal Pattern Message-ID: <ARTHUR.93Jan25122827@lurch.turing.ac.uk> Date: 25 Jan 93 12:34:39 GMT Sender: usenet@turing.ac.uk (Usenet for nntp) Organization: The Turing Institute Ltd., Glasgow, Scotland Lines: 81