diff options
author | Karl Berry <karl@freefriends.org> | 2017-11-26 23:25:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-11-26 23:25:50 +0000 |
commit | 429dc0fa4f8ccda0a0746211f00ad7d5bdbb6d41 (patch) | |
tree | 5ca3cbb4f34fdb9cb8ec472720e3a945bb69513f /Master/texmf-dist/dvips/pst-fractal | |
parent | 0fd5cd95c65cdfe2194010958ae552b4b1632bb8 (diff) |
pst-fractal (26nov17)
git-svn-id: svn://tug.org/texlive/trunk@45911 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips/pst-fractal')
-rw-r--r-- | Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro | 208 |
1 files changed, 200 insertions, 8 deletions
diff --git a/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro b/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro index 388447fd20f..5493d734a73 100644 --- a/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro +++ b/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro @@ -1,3 +1,4 @@ +%% $Id: pst-fractal.pro 659 2017-11-26 16:58:16Z herbert $ %% %% This is file `pst-fractal.pro', %% @@ -15,9 +16,9 @@ %% `pst-fractal' is a PSTricks package to draw fractal objects %% %% -%% version 0.02 / 2010-02-10 Herbert Voss <hvoss _at_ tug.org> +%% version 0.04 / 2017-11-26 Herbert Voss <hvoss _at_ tug.org> % -/tx@fractalDict 20 dict def +/tx@fractalDict 100 dict def tx@fractalDict begin % /tx@Fractal { @@ -46,7 +47,7 @@ tx@fractalDict begin /MaxXPixel ED /MaxY ED /MaxX ED /MinY ED /MinX ED - /rPixel 0.5 def + /rPixel 1 def /totMaxIter maxIter dIter mul def % /DX MaxX MinX sub def @@ -83,12 +84,12 @@ tx@fractalDict begin } repeat plot{ baseColor x y putPixel - }{ iter 400 add tx@addDict begin - ifCMYK { wavelengthToCMYK Cyan Magenta Yellow Black end setcmykcolor - }{ wavelengthToRGB Red Green Blue end setrgbcolor } ifelse + }{ iter 400 add + ifCMYK { tx@addDict begin wavelengthToCMYK Cyan Magenta Yellow Black end setcmykcolor + }{ tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor } ifelse ifJulia { x y }{ cx cy } ifelse - putPixel stroke - }ifelse % Plot point if point is in set + putPixel stroke + }ifelse % Plot point if point is in set } for } for } def @@ -129,6 +130,76 @@ tx@fractalDict begin } repeat } def % +/append { +% macro de Jean-Paul Vignault +% extraite de pst-solides3d.pro + 3 dict begin + /tab2 exch def + /tab1 exch def + [ tab1 aload pop tab2 aload pop ] + end +} def +% +/Rot-90 { + 2 dict begin + /y exch def /x exch def + y + x neg + end +} def +% +/makeSierVariables { + /Pi [1.5 unit 1 unit + 1 unit 0.5 unit + 1 unit -0.5 unit + 1.5 unit -1 unit + ] def +% + /P0 Pi def + /coefficient 1 def + 3 { + P0 + [ + 0 2 Pi length 2 sub {/i exch def + Pi i get Pi i 1 add get Rot-90 + } for + ] /Pi exch def + P0 Pi append /P0 exch def + } repeat +% +/P1 {[ + 0 2 P0 length 2 sub {/i exch def + P0 i get P0 i 1 add get % Rot-90 + -2 unit coefficient mul add exch + -2 unit coefficient mul add exch + } for +] } def +% +/P2 {[ +0 2 P0 length 2 sub {/i exch def +P0 i get P0 i 1 add get Rot-90 + 2 unit coefficient mul add exch +-2 unit coefficient mul add exch +} for +] }def +% +/P3 {[ +0 2 P0 length 2 sub {/i exch def +P0 i get P0 i 1 add get Rot-90 Rot-90 + 2 unit coefficient mul add exch +2 unit coefficient mul add exch +} for +] } def +% +/P4 {[ + 0 2 P0 length 2 sub {/i exch def + P0 i get P0 i 1 add get Rot-90 Rot-90 Rot-90 + -2 unit coefficient mul add exch + 2 unit coefficient mul add exch + } for +] } def +} def +% /tx@Phyllotaxis { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \pst@tempA % \pst@fractal@c @@ -326,4 +397,125 @@ tx@fractalDict begin pop pop pop pop { count 0 eq { exit } if appol } loop } def % +/tx@Hugo { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%Creator: Hugo M. Ayala'89, MIT +% \pst@fractal@scale +% \pst@tempA +% \pst@fractal@maxIter, which is the depth +% \pst@number\pslinewidth +% { \pst@usecolor\pslinecolor } +/setColor ED +SLW +/depth ED +translate +dup scale +2 setlinecap +setColor +% +/oldarrayx [0 540 72 72] def +/oldarrayy [0 396 720 72] def +% +/scl .1 def +% +realtime srand +/prorand { rand 32768 div 32768 div 1 sub scl mul} def +/findrow {8 mul 7 sub sqrt 1 add 2 div truncate} def +/findindex {dup 1 sub mul 2 div 1 add} def +/findcolumn {dup findrow findindex sub} def +/findnewrow {2 mul 1 sub} def +/findnewcolumn {2 mul} def +/findarraysize {dup 1 add mul 2 div 1 add} def +/findnumoflines {dup 1 sub mul 2 div 3 mul} def +/findnumpoints {dup 1 add mul 2 div} def +/gtol {2 exch exp 1 add} def +/fixangle {dup 180 ge {180 sub} if} def +/backangle {dup 180 ge {180 sub} {180 add} ifelse} def +/splitline { + tpx btx add 2 div /mdx exch def + tpy bty add 2 div /mdy exch def + tpy bty sub tpx btx sub atan + 90 add fixangle + /lineangle exch def + tpy bty sub dup mul + tpx btx sub dup mul + add sqrt /linelen exch def + prorand linelen mul dup + lineangle cos mul mdx add /mdx exch def + lineangle sin mul mdy add /mdy exch def +} def +% +/findnewindex{ cvi /oldindex exch def + oldindex findrow cvi dup /oldrow exch def + findindex oldindex exch sub cvi /oldcolumn exch def + oldrow findnewrow cvi dup /newrow exch def findindex + oldcolumn findnewcolumn cvi dup /newcolumn exch def add + cvi /newindex exch def +} def +% +/drawfractal { + 1 1 generation gtol 1 sub findnumpoints { + cvi /topindex exch def + topindex dup findcolumn exch findrow 1 add findindex add cvi + /leftindex exch def + leftindex 1 add cvi + /rightindex exch def + /tpx oldarrayx topindex get def + /tpy oldarrayy topindex get def + /btx oldarrayx leftindex get def + /bty oldarrayy leftindex get def + /mdx oldarrayx rightindex get def + /mdy oldarrayy rightindex get def + tpx tpy moveto + btx bty lineto + mdx mdy lineto + closepath stroke + } for +} def +% +1 1 depth { + /generation exch def + generation gtol findarraysize cvi dup array /newarrayx exch def + array /newarrayy exch def + 1 1 generation 1 sub gtol findnumpoints { + findnewindex + newarrayx newindex + oldarrayx oldindex get put + newarrayy newindex + oldarrayy oldindex get put + } for + 1 1 generation 1 sub gtol 1 sub findnumpoints { + findnewindex + newcolumn newrow 2 add findindex add cvi dup + /leftindex exch def + 2 add cvi /rightindex exch def + newcolumn newrow 1 add findindex add cvi + /mindex exch def + /tpx newarrayx newindex get def + /tpy newarrayy newindex get def + /btx newarrayx leftindex get def + /bty newarrayy leftindex get def + splitline + newarrayx mindex mdx put + newarrayy mindex mdy put + mindex 1 add cvi /mindex exch def + /btx newarrayx rightindex get def + /bty newarrayy rightindex get def + splitline + newarrayx mindex mdx put + newarrayy mindex mdy put + /mindex leftindex 1 add cvi def + /tpx newarrayx leftindex get def + /tpy newarrayy leftindex get def + splitline + newarrayx mindex mdx put + newarrayy mindex mdy put + } for + /oldarrayx newarrayx def + /oldarrayy newarrayy def + 7 generation sub 5 div setlinewidth +% drawfractal showpage +} for +drawfractal +} def % end of /tx@Hugo +% end |