summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-26 23:25:50 +0000
committerKarl Berry <karl@freefriends.org>2017-11-26 23:25:50 +0000
commit429dc0fa4f8ccda0a0746211f00ad7d5bdbb6d41 (patch)
tree5ca3cbb4f34fdb9cb8ec472720e3a945bb69513f /Master/texmf-dist/tex/generic
parent0fd5cd95c65cdfe2194010958ae552b4b1632bb8 (diff)
pst-fractal (26nov17)
git-svn-id: svn://tug.org/texlive/trunk@45911 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex129
1 files changed, 107 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex b/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex
index 1fc81444324..2c43333f82d 100644
--- a/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex
+++ b/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex
@@ -1,3 +1,4 @@
+%% $Id: pst-fractal.tex 659 2017-11-26 16:58:16Z herbert $
%%
%% This is file `pst-fractal.tex',
%%
@@ -21,8 +22,8 @@
\ifx\PSTricksAddLoaded\endinput\else\input pstricks-add.tex\fi
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
%
-\def\fileversion{0.06}
-\def\filedate{2010/02/10}
+\def\fileversion{0.08}
+\def\filedate{2017/11/26}
\message{`PST-fractal' v\fileversion, \filedate\space (hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -68,6 +69,10 @@
\define@boolkey[psset]{pst-fractal}[Pst@fractal@]{Color}[true]{}
\psset[pst-fractal]{Radius=5cm,Color=false}
%
+\define@key[psset]{pst-fractal}{n}{\def\pst@fractal@n{#1 }}
+\define@key[psset]{pst-fractal}{dotcolor}{\pst@getcolor{#1}\psdotcolor}
+\define@key[psset]{pst-fractal}{N}{\def\pst@fractal@N{#1}}
+\psset[pst-fractal]{n=3,N=all,dotcolor=red}
%===========================================================
%
\def\psfractal{\pst@object{psfractal}}
@@ -75,7 +80,7 @@
\def\psfractal@ii(#1){\@ifnextchar({\psfractal@iii(#1)}{\psfractal@iii(#1)(1,1)}}%
\def\psfractal@iii(#1)(#2){%
\begin@SpecialObj
- \psset{unit=1pt}
+ \psset{unit=1pt}%
\pst@getcoor{#1}\pst@temp@A
\pst@getcoor{#2}\pst@temp@B
\pspicture(\pst@fractal@xWidth,\pst@fractal@yWidth)%
@@ -91,15 +96,17 @@
\pst@fractal@maxRadius
{ \pst@usecolor\pst@fractal@baseColor }
\ifx\pst@fractal@type\pst@fractal@Julia true \else false \fi
- \ifPst@CMYK true \else false \fi ^^J%
- tx@fractalDict begin tx@Fractal end ^^J%
+ \ifPst@CMYK true \else false \fi ^^J
+ tx@fractalDict begin tx@Fractal end ^^J
}% end add@pscode
- \endpspicture% end box
- \end@SpecialObj%
+ \endpspicture
+ \end@SpecialObj
\ignorespaces}
%
\def\psSier{\pst@object{psSier}}
-\def\psSier@i(#1){\@ifnextchar({\psSier@ii(#1)}{\psSier@iii(#1)}}
+\def\psSier@i{\@ifnextchar({\psSier@v}{\psSier@vi}}
+%
+\def\psSier@v(#1){\@ifnextchar({\psSier@ii(#1)}{\psSier@iii(#1)}}
\def\psSier@ii(#1)(#2)(#3){{%
\pst@getcoor{#1}\pst@temp@A
\pst@getcoor{#2}\pst@temp@B
@@ -133,11 +140,72 @@
\pst@tempB\space dup scale
0 setlinewidth
0 0 moveto 1 0 lineto 0.5 0.8660254 lineto 0 setlinewidth closepath
- gsave \pst@usecolor\psfillcolor fill grestore stroke
- #3 sierpy }%
+ gsave #3 0 gt { \pst@usecolor\psfillcolor }{ \pst@usecolor\pslinecolor } ifelse
+ fill grestore stroke
+ #3 dup 0 gt { sierpy } if }%
\end@OpenObj%
}
%
+\def\psSier@vi{% Siepinski curve
+ \begin@SpecialObj
+ \addto@pscode{
+ /n@ \pst@fractal@n def
+ /NbrePts (\pst@fractal@N) def
+ NbrePts (all) eq {/Npts 4 n@ 1 add exp cvi def}{/Npts NbrePts cvi def Npts 4 n@ 1 add exp gt {/Npts 4 n@ 1 add exp cvi def} if } ifelse
+ /dotcolor {\pst@usecolor\psdotcolor } def
+ /unit { \pst@number\psunit mul } def
+ tx@fractalDict begin
+ makeSierVariables
+%
+ n@ 1 eq {/Sierpinsky P0 def}{
+ n@ 1 sub {
+ /Sierpinsky P1 P2 append P3 append P4 append def
+%
+ /Tab1 [
+ 0 2 Sierpinsky length 2 sub {/i exch def
+ Sierpinsky i 2 getinterval
+ } for
+ ] def
+ /i@ Sierpinsky length 8 div 2.5 mul cvi def %
+ /Sierpinsky2 [
+ Tab1 length {
+ Tab1 i@ get
+ /i@ i@ 1 add def
+ i@ Tab1 length ge {/i@ 0 def} if
+ }repeat
+ ] def
+%
+ /P0 [
+ 0 1 Sierpinsky2 length 1 sub {/i exch def
+ Sierpinsky2 i get aload pop
+ } for
+ ] def
+ /coefficient coefficient 2 mul def
+ } repeat } ifelse
+%
+ newpath
+ Sierpinsky 0 get Sierpinsky 1 get moveto
+ 0 2 Sierpinsky length 2 sub {/i exch def
+ i 2 div Npts ge {exit} if
+ Sierpinsky i get Sierpinsky i 1 add get lineto
+ } for
+ Npts 4 n@ 1 add exp cvi ge {closepath} if
+ \ifx\psk@fillstyle\relax\else gsave \pst@usecolor\psfillcolor fill grestore\fi
+ \ifx\pslinestyle\@none\else \psls@solid stroke \fi
+ \ifshowpoints
+ 0 2 Sierpinsky length 2 sub {/i exch def
+ i 2 div Npts ge {exit} if
+ Sierpinsky i get
+ Sierpinsky i 1 add get
+ \psk@dotsize DS
+ 0 360 arc dotcolor fill
+ } for
+ \fi
+ end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
%
\def\psPhyllotaxis{\pst@object{psPhyllotaxis}}
\def\psPhyllotaxis@i{\@ifnextchar({\psPhyllotaxis@ii}{\psPhyllotaxis@ii(0,0)}}
@@ -174,6 +242,23 @@
\end@SpecialObj%
}}
%
+\def\psHugo{\pst@object{psHugo}}
+\def\psHugo@i{\@ifnextchar({\psHugo@ii}{\psHugo@ii(0,0)}}
+\def\psHugo@ii(#1){{%
+ \addbefore@par{scale=0.1,linewidth=0.001pt,maxIter=5}%
+ \pst@getcoor{#1}\pst@tempA%
+ \begin@SpecialObj%
+ \addto@pscode{
+ \pst@fractal@Xscale
+ \pst@tempA
+ \pst@fractal@maxIter
+ \pst@number\pslinewidth
+ { \pst@usecolor\pslinecolor }
+ tx@fractalDict begin tx@Hugo end
+ }% end add@pscode
+ \end@SpecialObj%
+}}
+%
\def\psKochflake{\pst@object{psKochflake}}
\def\psKochflake@i{\@ifnextchar({\psKochflake@ii}{\psKochflake@ii(0,0)}}
\def\psKochflake@ii(#1){{%
@@ -184,12 +269,12 @@
gsave ^^J%
\pst@tempA translate
\pst@usecolor\pslinecolor
- \pst@fractal@angle rotate ^^J%
- \pst@number\pslinewidth 10 div \pst@fractal@Xscale div SLW ^^J%
- \pst@fractal@maxIter ^^J%
- tx@fractalDict begin ^^J%
- \pst@fractal@scale ^^J%
- tx@Kochflake end ^^J%
+ \pst@fractal@angle rotate ^^J
+ \pst@number\pslinewidth 10 div \pst@fractal@Xscale div SLW ^^J
+ \pst@fractal@maxIter ^^J
+ tx@fractalDict begin ^^J
+ \pst@fractal@scale ^^J
+ tx@Kochflake end ^^J
}% end add@pscode
\psk@fillstyle
\addto@pscode{stroke grestore }
@@ -206,14 +291,14 @@
\pst@fractal@dIter
\pst@number\pst@fractal@Radius
\ifPst@fractal@Color true \else false \fi
- \ifPst@CMYK true \else false \fi ^^J%
- tx@fractalDict begin ^^J%
- gsave ^^J%
- \pst@tempA translate ^^J%
+ \ifPst@CMYK true \else false \fi ^^J
+ tx@fractalDict begin ^^J
+ gsave ^^J
+ \pst@tempA translate ^^J
\pst@usecolor\pslinecolor
\pst@fractal@scale
- \pst@number\pslinewidth SLW ^^J%
- tx@Appolonius end ^^J%
+ \pst@number\pslinewidth SLW ^^J
+ tx@Appolonius end ^^J
}% end add@pscode
\psk@fillstyle%
\addto@pscode{stroke grestore}%