Thread View: comp.lang.postscript
2 messages
2 total messages
Started by Arthur van Hoff
Mon, 25 Jan 1993 12:34
Hexagonal Pattern
Author: 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.
Re: Hexagonal Pattern
Author: Allen B
Date: Mon, 25 Jan 1993 17:32
Date: Mon, 25 Jan 1993 17:32
17 lines
1090 bytes
1090 bytes
In article <ARTHUR.93Jan25122827@lurch.turing.ac.uk> arthur@turing.ac.uk (Arthur van Hoff) writes: > Here is a simple PdB program (the compiled PostScript is also > included) that draws an amazing hexagonal pattern resembling > that of the human retina. Wow, that is neat. I haven't messed with PdB yet (I'm pretty proficient the old-fashioned way :-) ), but I do plan to. Question: can you make it preface your file with a bounding box so it looks like a good EPS document? How about DSC in general? If it would do that, it'd make incorporating your PdB programs into drawing programs and such much easier. Ease is the point, afterall. :-) ab
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads