Article View: comp.lang.postscript
Article #245fractals
From: Patrick Dockhorn
Date: Mon, 10 Aug 1992 16:38
Date: Mon, 10 Aug 1992 16:38
85 lines
2547 bytes
2547 bytes
this was just posted to clc - it's a little bit older and I hope there's
nothing to copy left, but it's to nice to keep it secret ;-)
--
Patrick Dockhorn Forschungszentrum Informatik, Karlsruhe/Germany.
INTERNET: dockhorn@fzi.de There are two rules for success in life:
BITNET : ukew@dkauni2.bitnet Rule 1: Don't tell people everything you know.
%!
% ============================================================================
% Generate a fractal fern by first creating a table of 128 different transformations based on the required
% probablilities. This table is then used to build up the final fern. The first 20 dots are thrown out to
% give the stange attractor time to start strange attracting. It takes a mere 28 data values to completely
% define this fractal image.
% References: Lancaster, Don. Some Assembly Required, PostScript Insider Secrets. Byte, July 1990. 300.
% ============================================================================
/problistcreate
{
mark
/counter 0 def
probabilities
{
128 mul round cvi
{ transforms counter get } repeat
/counter counter 1 add def
} forall
counttomark 128 sub neg dup 0 gt
{ [1 0 0 1 0 0] repeat }
{ pop }
ifelse
]
/problist exch def
} bind def
/doit
{
problistcreate
1 1 20
{
problist rand -24 bitshift get transform
2 copy moveto
0.001 10 rlineto
} repeat
newpath
numdots
{
problist rand -24 bitshift get transform
2 copy moveto
0.001 0 rlineto
stroke
} repeat
} bind def
% ============================================================================
/numdots 100000 def % increase for denser image; decrease to print faster
/transforms
[
[0 0 0 0.16 0 0]
[0.2 0.23 -0.26 0.22 0 1.6]
[-0.15 0.26 0.28 0.24 0 0.44]
[0.85 -0.04 0.04 0.85 0 1.6]
] def
/probabilities [0.01 0.07 0.07 0.85] def
1 setlinecap
0 setlinewidth
200 300 translate
30 dup scale
doit
showpage
quit
% ============================================================================
Technical Details
Message-ID:
<1992Aug10.163831.26417@fzi.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!gate.fzi.de!dockhornShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!gate.fzi.de!dockhorn From: dockhorn@fzi.de (Patrick Dockhorn) Subject: fractals Message-ID: <1992Aug10.163831.26417@fzi.de> Followup-To: poster Keywords: fractals PostScript Sender: news@fzi.de (FZI-news) Reply-To: dockhorn@fzi.de Organization: Forschungszentrum Informatik (FZI), Karlsruhe, Germany Date: Mon, 10 Aug 1992 16:38:31 GMT Lines: 88