From 509398cb59d3930b2f3c77ad69d9203aebf45d5f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 15 Oct 2022 20:24:03 +0000 Subject: pst-fractal (14oct22) git-svn-id: svn://tug.org/texlive/trunk@64714 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-fractal/Changes | 2 + .../doc/generic/pst-fractal/pst-fractal-doc.pdf | Bin 31953724 -> 32019437 bytes .../doc/generic/pst-fractal/pst-fractal-doc.tex | 25 ++++++++- .../texmf-dist/dvips/pst-fractal/pst-fractal.pro | 27 +++++++--- .../tex/generic/pst-fractal/pst-fractal.tex | 59 ++++++++++++++++----- 5 files changed, 93 insertions(+), 20 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/pst-fractal/Changes b/Master/texmf-dist/doc/generic/pst-fractal/Changes index 6241641461c..35601820165 100644 --- a/Master/texmf-dist/doc/generic/pst-fractal/Changes +++ b/Master/texmf-dist/doc/generic/pst-fractal/Changes @@ -1,4 +1,5 @@ pst-fractal.pro -------- +0.07 2022-10-13 don't use dict for Sirpinski curve 0.06 2017-12-04 added Hilbert fractal 0.05 2017-12-02 added fibinacci curves 0.04 2017-11-26 add sierpinski curve @@ -8,6 +9,7 @@ pst-fractal.pro -------- pst-fractal.tex -------- +0.12 2022-10-13 - added Sierpinski carpet 0.11a 2020-03-16 - small changes to the documentation 0.11 2020-03-10 - fixed trailing space in \pstKochflake 0.10 2018-11-10 - added Cantor set diff --git a/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.pdf b/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.pdf index b31dda9957c..79d3207a5e7 100644 Binary files a/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.pdf and b/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.tex b/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.tex index c5b82616cc5..7a5796cff39 100644 --- a/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-fractal/pst-fractal-doc.tex @@ -107,7 +107,7 @@ The defaults are 2mm, black, 5, 10cm, and 5mm. \end{LTXexample} -\section{Sierpinski triangle and curve} +\section{Sierpinski triangle, curve and carpet} The triangle must be given by three mandatory arguments. Depending to the kind of arguments it is one of the two possible versions: @@ -199,6 +199,29 @@ There are four special optional arguments for the Siepinski curve: \end{verbatim} +\subsection{Carpet} + +There are four special optional arguments for the Sierpinski carpet: +\begin{itemize} + \item \texttt{[n=3]} : number of iterations + \item \texttt{[linecolor=red]} : + \item \texttt{[scale=1]} : scaling of the carpet +\end{itemize} + +\begin{LTXexample}[pos=t] +\begin{pspicture}(10,10) +\psSierCarpet% The default with a width of 10cm +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid](-4,-4)(4,4) +\psSierCarpet[n=6,linecolor=blue,scale=0.8](-5,-5) % with scale it is (-4,-4) +\end{pspicture} +\end{LTXexample} + + \section{Julia and Mandelbrot sets} diff --git a/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro b/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro index fcdc69bb99a..1c5fb9d9b75 100644 --- a/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro +++ b/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro @@ -16,7 +16,7 @@ %% `pst-fractal' is a PSTricks package to draw fractal objects %% %% -%% version 0.06 / 2017-12-04 Herbert Voss +%% version 0.07 / 2022-10-13 Herbert Voss % /tx@fractalDict 100 dict def tx@fractalDict begin @@ -68,17 +68,18 @@ tx@fractalDict begin MinY dy MaxY { ifJulia { /y exch def }{ /cy exch def /y 0.0 def } ifelse /iter 0 def - /zx x def - /zy y def + /z [x y] def + /c [cx cy] def /plot true def totMaxIter cvi { - zx dup mul zy dup mul add maxRadius gt { + z cxnorm2 maxRadius gt { /plot false def exit }{% Calculate next value - 2 zx zy mul mul cy add - /zx zx dup mul zy dup mul sub cx add def - /zy exch def +% z 5 cxexp c add +% z dup cxmul c cxadd + z FractalFunc + /z ED /iter iter dIter add def } ifelse } repeat @@ -100,6 +101,7 @@ tx@fractalDict begin % \pst@temp@C % { \pst@usecolor\pslinecolor } % \pst@fractal@plotpoints +20 dict begin /plotpoints ED /setColor ED /Coor ED @@ -128,6 +130,7 @@ tx@fractalDict begin rand nCoor mod dup add newPosition } repeat +end } def % /Rot-90 { @@ -139,6 +142,7 @@ tx@fractalDict begin } def % /tx@SierpinskiCurve { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%25 dict begin /Pi [1.5 cmunit 1 cmunit 1 cmunit 0.5 cmunit 1 cmunit -0.5 cmunit @@ -224,6 +228,7 @@ tx@fractalDict begin useFill { gsave fillColor fill grestore } if % useLineStyle +%end } def % /tx@Phyllotaxis { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -231,6 +236,7 @@ tx@fractalDict begin % \pst@fractal@c % \pst@fractal@angle % \pst@fractal@maxIter CMYK +10 dict begin /ifCMYK ED /maxIter ED /fractalAngle ED @@ -251,6 +257,7 @@ tx@fractalDict begin grestore stroke } for +end } def % /tx@Fern { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -260,6 +267,7 @@ tx@fractalDict begin % \pst@fractal@radius % \pst@number\pslinewidth % { \pst@usecolor\pslinecolor } +20 dict begin /setColor ED SLW /radius ED @@ -284,6 +292,7 @@ tx@fractalDict begin m transform 2 copy radius 0 360 arc stroke } repeat +end } def % /tx@Kochflake { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -325,6 +334,7 @@ tx@fractalDict begin % \pst@fractal@scale % \pst@number\pslinewidth SLW % +30 dict begin /ifCMYK ED /ifColor ED /Radius ED @@ -421,6 +431,7 @@ tx@fractalDict begin 1 1 4 { pop circle } for 1 1 4 { pop 3 polydup collect 5 1 roll 4 1 roll } for pop pop pop pop { count 0 eq { exit } if appol } loop +end } def % /tx@Hugo { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -430,6 +441,7 @@ tx@fractalDict begin % \pst@fractal@maxIter, which is the depth % \pst@number\pslinewidth % { \pst@usecolor\pslinecolor } +50 dict begin /setColor ED SLW /depth ED @@ -542,6 +554,7 @@ realtime srand % drawfractal showpage } for drawfractal +end } def % end of /tx@Hugo % /FibonacciFractal { 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 b77cb42e060..b477891041d 100644 --- a/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex +++ b/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex @@ -19,11 +19,12 @@ \csname PSTfractalLoaded\endcsname \let\PSTfractalLoaded\endinput \ifx\PSTricksLoaded\endinput\else \input pstricks.tex\fi +\ifx\PSTfuncLoaded\endinput \else \input pst-func.tex\fi \ifx\PSTricksAddLoaded\endinput\else\input pstricks-add.tex\fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi % -\def\fileversion{0.11a} -\def\filedate{2020/03/16} +\def\fileversion{0.12} +\def\filedate{2022/10/13} \message{`PST-fractal' v\fileversion, \filedate\space (hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -41,6 +42,9 @@ \def\pst@fractal@Julia{Julia}\def\pst@fractal@Mandel{Mandel} \define@key[psset]{pst-fractal}{baseColor}[white]{\pst@getcolor{#1}\pst@fractal@baseColor} \psset[pst-fractal]{baseColor=white} +\define@key[psset]{pst-fractal}{function}[z z cxmul c cxadd ]{\def\pst@fractal@function{#1 }} +\psset{function=z z cxmul c cxadd} + % \define@key[psset]{pst-fractal}{cx}[0]{\def\pst@fractal@cx{#1 }} \define@key[psset]{pst-fractal}{cy}[0]{\def\pst@fractal@cy{#1 }} @@ -368,7 +372,10 @@ { \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 + tx@fractalDict begin + /FractalFunc { /z ED \pst@fractal@function } def + tx@Fractal end + ^^J }% end add@pscode \endpspicture \end@SpecialObj @@ -436,7 +443,8 @@ /dotcolor { \pst@usecolor\psdotcolor } def /cmunit { \pst@number\psunit mul } 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 - tx@fractalDict begin tx@SierpinskiCurve + tx@fractalDict begin + tx@SierpinskiCurve \ifshowpoints 0 2 Sierpinsky length 2 sub { /i exch def @@ -453,6 +461,34 @@ \end@SpecialObj \ignorespaces} % +\def\psSierCarpet{\pst@object{psSierCarpet}} +\def\psSierCarpet@i{\@ifnextchar({\psSierCarpet@ii}{\psSierCarpet@ii(0,0)}} +% +\def\psSierCarpet@ii(#1){{% + \pst@getcoor{#1}\pst@temp@A + \begin@SpecialObj + \addto@pscode{ + \pst@fractal@scale + \pst@temp@A\space translate + /r { moveto 0 -1 1 0 0 1 3 { rlineto } repeat closepath fill } def + /serp { gsave + 3 1 roll translate + 1 3 div dup scale + 1 1 r + dup 1 sub dup 0 eq not { + 0 0 0 1 0 2 1 0 1 2 2 0 2 1 2 2 17 -1 roll 8 { serp } repeat + } if pop + grestore + } def + 300 300 scale 0 0 r 1 setgray + 0 0 \pst@fractal@n serp + }% + \showpointsfalse + \end@SpecialObj + \ignorespaces +}} +% +% \def\psPhyllotaxis{\pst@object{psPhyllotaxis}} \def\psPhyllotaxis@i{\@ifnextchar({\psPhyllotaxis@ii}{\psPhyllotaxis@ii(0,0)}} \def\psPhyllotaxis@ii(#1){{% @@ -538,16 +574,15 @@ \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 - \pst@usecolor\pslinecolor - \pst@fractal@scale - \pst@number\pslinewidth SLW ^^J - tx@Appolonius end ^^J + gsave ^^J + \pst@tempA translate ^^J + \pst@usecolor\pslinecolor + \pst@fractal@scale + \pst@number\pslinewidth SLW ^^J + tx@fractalDict begin tx@Appolonius end ^^J }% end add@pscode \psk@fillstyle% - \addto@pscode{stroke grestore}% + \addto@pscode{stroke grestore ^^J }% \end@SpecialObj% }} % -- cgit v1.2.3