%%This postscript program will generate an IFS fractal image on a postscript %%printer. %% %%There are three things that can be changed to alter the image produced. %% %%1. The value following the /numdots is the number of iterations that %% will generate points in the resulting image. %%2. The values in the array following the /transforms statement controls %% the overall image generation %%3. The values in the array following the /probabilities determines the %% effect of each row of the /transforms array on the resulting image. %% %%For those of you that are not familar with postscript code, the two numbers %%in the last line preceeding the translate command control the position of %%the image on the page relative to the lower left corner and the value %%prior to the "dup scale" command in the last line controls the size of %%the printed image. %% %%Cut as indicated and send the result to your favorite postscript printer. %% /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 .001 10 rlineto} repeat newpath numdots { problist rand -24 bitshift get transform 2 copy moveto .001 0 rlineto stroke } repeat } bind def %% /// demo - remove or alter before reuse /// /numdots 10000 def % increase for denser image; decrease for faster print /transforms [ [ 0 0 0 .16 0 0] [.2 .23 -.26 .22 0 1.6] [-.15 .26 .28 .24 0 .44] [.85 -.04 -.04 .85 0 1.6] ] def /probabilities [.01 .07 .07 .85] def 1 setlinecap 0 setlinewidth 300 100 translate 50 dup scale doit showpage quit .