summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex278
1 files changed, 233 insertions, 45 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 2c43333f82d..926173f4f10 100644
--- a/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex
+++ b/Master/texmf-dist/tex/generic/pst-fractal/pst-fractal.tex
@@ -1,4 +1,4 @@
-%% $Id: pst-fractal.tex 659 2017-11-26 16:58:16Z herbert $
+%% $Id: pst-fractal.tex 673 2017-12-02 22:04:41Z herbert $
%%
%% This is file `pst-fractal.tex',
%%
@@ -22,8 +22,8 @@
\ifx\PSTricksAddLoaded\endinput\else\input pstricks-add.tex\fi
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
%
-\def\fileversion{0.08}
-\def\filedate{2017/11/26}
+\def\fileversion{0.09}
+\def\filedate{2017/12/02}
\message{`PST-fractal' v\fileversion, \filedate\space (hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -73,8 +73,221 @@
\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}
+
+\define@key[psset]{pst-fractal}{i}{\def\pst@fractal@i{#1 }} % i-Fibonacci
+\define@key[psset]{pst-fractal}{morphism}{\def\pst@fractal@morphism{#1}} % les substitutions
+\define@boolkey[psset]{pst-fractal}[Pst@]{juxtaposition}[true]{} %
+\define@key[psset]{pst-fractal}{colorF}{\pst@getcolor{#1}\pscolorF}
+\psset[pst-fractal]{morphism=(0) (1) (2),juxtaposition=false,colorF=red,i=6}
+
%===========================================================
%
+\def\psFibonacci{\pst@object{psFibonacci}}
+\def\psFibonacci@i{%
+ \addbefore@par{n=10, angle=90}%
+ \begin@SpecialObj
+ \addto@pscode{
+ /cmunit {\pst@number\psunit mul} bind def % mise à l'échelle
+ /angle \pst@fractal@angle def
+ /n@ \pst@fractal@n def
+ n@ 3 le {/n@ 3 def} if
+ /ColorF { \pst@usecolor\pscolorF } def
+ /setLineColor { \pst@usecolor\pslinecolor } def
+ /Pst@juxtaposition \ifPst@juxtaposition true \else false \fi def
+ /F1 (1) def
+ /F2 (0) def
+ /tx { x1 x0 sub } def
+ /ty { y1 y0 sub } def
+ /x0 0 def /y0 0 def
+ x0 y0 moveto
+ /x1 0 def /y1 1 cmunit def
+ x1 y1 lineto
+ tx@fractalDict begin FibonacciFractal end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+%
+%
+\def\psNewFibonacci{\def\pst@par{}\pst@object{psNewFibonacci}}
+\def\psNewFibonacci@i{%
+ \addbefore@par{n=10, angle=90}%
+ \begin@SpecialObj
+ \addto@pscode{
+ /cmunit {\pst@number\psunit mul} bind def % mise à l'échelle
+ /angle \pst@fractal@angle def
+ /n@ \pst@fractal@n def
+ n@ 3 le {/n@ 3 def} if
+ /morhism [\pst@fractal@morphism] def
+ /setLineColor { \pst@usecolor\pslinecolor } def
+ /m@0 morhism 0 get def
+ /m@1 morhism 1 get def
+ /m@2 morhism 2 get def
+ /F1 (1) def
+ /F2 (0) def
+ /tx {x1 x0 sub} def
+ /ty {y1 y0 sub} def
+ /x0 0 def /y0 0 def
+ x0 y0 moveto
+ /x1 0 def /y1 1 cmunit def
+ x1 y1 lineto
+ tx@fractalDict begin newFibonacciFractal end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+%
+% i-Fibonacci
+\def\psiFibonacci{\def\pst@par{}\pst@object{psiFibonacci}}
+\def\psiFibonacci@i{%
+ \addbefore@par{angle=90}%
+ \begin@SpecialObj
+ \addto@pscode{
+ /cmunit {\pst@number\psunit mul} def
+ /angle \pst@fractal@angle def
+ /n@ \pst@fractal@n def
+ n@ 3 le {/n@ 3 def} if
+ /i@ \pst@fractal@i def
+ /setLineColor { \pst@usecolor\pslinecolor } bind def
+ tx@fractalDict begin i-FibonacciFractal end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+%
+% 30 septembre 2017
+% k-Fibonacci
+\define@key[psset]{pst-fractal}{k}{\def\pst@fractal@k{#1 }} % k
+\psset[pst-fractal]{k=5}
+%
+\def\pskFibonacci{\def\pst@par{}\pst@object{pskFibonacci}}
+\def\pskFibonacci@i{\@ifnextchar({\pskFibonacci@ii}{\pskFibonacci@ii(0,0)}}
+\def\pskFibonacci@ii(#1){%
+ \addbefore@par{k=5,angle=90}%
+ \begin@SpecialObj
+ \pst@@getcoor{#1}%
+ \addto@pscode{
+ \pst@coor /t@y ED /t@x ED
+ /cmunit {\pst@number\psunit mul} bind def % mise à l'échelle
+ /cmunit_1 {\pst@number\psunit div} bind def % mise à l'échelle
+ /angle \pst@fractal@angle def
+ /n@ \pst@fractal@n def
+ /k@ \pst@fractal@k def
+ /setLineColor { \pst@usecolor\pslinecolor } def
+ tx@fractalDict begin k-FibonacciFractal end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+%
+% 1 octobre 2017
+% Biperiodic-Fibonacci-Words
+\define@key[psset]{pst-fractal}{a}{\def\pst@fractal@a{#1 }} % k
+\psset[pst-fractal]{a=5}
+\define@key[psset]{pst-fractal}{b}{\def\pst@fractal@b{#1 }} % k
+\psset[pst-fractal]{b=5}
+%
+\def\psBiperiodicFibonacci{\def\pst@par{}\pst@object{psBiperiodicFibonacci}}
+\def\psBiperiodicFibonacci@i{\@ifnextchar({\psBiperiodicFibonacci@ii}{\psBiperiodicFibonacci@ii(0,0)}}
+\def\psBiperiodicFibonacci@ii(#1){%
+ \addbefore@par{a=5,b=5,angle=90,n=3,k=5}
+ \begin@SpecialObj
+ \pst@@getcoor{#1}%
+ \addto@pscode{
+ \pst@coor /t@y ED /t@x ED
+ /cmunit {\pst@number\psunit mul} bind def
+ /cmunit_1 {\pst@number\psunit div} bind def
+ /a@ \pst@fractal@a def
+ /b@ \pst@fractal@b def
+ /angle \pst@fractal@angle def
+ /n@ \pst@fractal@n def
+ /k@ \pst@fractal@k def
+ /setLineColor { \pst@usecolor\pslinecolor } def
+ tx@fractalDict begin Biperiodic-FibonacciWords end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+%
+% 3 octobre 2017
+%
+\def\psFibonacciPolyominoes{\pst@object{psFibonacciPolyominoes}}
+\def\psFibonacciPolyominoes@i{\@ifnextchar({\psFibonacciPolyominoes@ii}{\psFibonacciPolyominoes@ii(0,0)}}
+\def\psFibonacciPolyominoes@ii(#1){%
+ \addbefore@par{n=3}
+ \begin@SpecialObj
+ \pst@@getcoor{#1}%
+ \addto@pscode{
+ \pst@coor /t@y ED /t@x ED
+ /cmunit {\pst@number\psunit mul} bind def % mise à l'échelle
+ /n@ \pst@fractal@n def
+ /setFillColor {
+ \ifx\psk@fillstyle\relax\else
+ gsave \pst@usecolor\psfillcolor fill grestore
+ \fi } def
+ /setLineColor{ \ifx\pslinestyle\@none\else stroke \fi } def
+ tx@fractalDict begin FibonacciPolyominoes end
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+%
+% type de fonte et taille
+\define@boolkey[psset]{pst-fractal}[Pst@]{DFW}[true]{} %
+\define@boolkey[psset]{pst-fractal}[Pst@]{iFibonacci}[true]{} %
+\psset[pst-fractal]{DFW=false,iFibonacci=false} %
+%
+\def\psFibonacciWord{\pst@object{psFibonacciWord}}
+\def\psFibonacciWord@i{\@ifnextchar({\psFibonacciWord@ii}{\psFibonacciWord@ii(0,0)}}
+\def\psFibonacciWord@ii(#1,#2){%
+ \addbefore@par{%PSfont=Times-Roman,
+ fontscale=8}
+ \begin@SpecialObj
+ \addto@pscode{
+ /n@ \pst@fractal@n def
+ /i@ \pst@fractal@i def
+ n@ 3 le {/n@ 3 def} if
+ /cmunit {\pst@number\psunit mul} bind def % mise à l'échelle
+ /PSfont {\psk@PSfont} def
+ PSfont findfont \psk@fontscale scalefont setfont
+ /F1 (1) def
+ /F2 (0) def
+ n@ 2 sub{
+ /Fi F2 F1 concatstrings def
+ /F1 F2 def
+ /F2 Fi def
+ } repeat
+ \ifPst@DFW
+ /Fi () def
+ 0 2 F2 length 2 sub {/i exch def
+ /I F2 i 2 getinterval def
+ I (00) eq {Fi (0) concatstrings /Fi exch def} if
+ I (01) eq {Fi (1) concatstrings /Fi exch def} if
+ I (10) eq {Fi (2) concatstrings /Fi exch def} if
+ } for
+ \fi
+ \ifPst@iFibonacci
+ /F0 (0) def
+ /Fi () def
+ i@ 1 sub {
+ Fi (0) concatstrings /Fi exch def
+ } repeat
+ Fi (1) concatstrings
+ /F1 exch def
+ n@ {
+ F1 F0 concatstrings
+ /Fi exch def
+ /F0 F1 def
+ /F1 Fi def
+ } repeat
+ \fi
+ #1 cmunit #2 cmunit moveto Fi show
+ }%
+ \showpointsfalse
+ \end@SpecialObj
+ \ignorespaces}
+
+%
\def\psfractal{\pst@object{psfractal}}
\def\psfractal@i{\@ifnextchar({\psfractal@ii}{\psfractal@ii(-1,-1)}}%
\def\psfractal@ii(#1){\@ifnextchar({\psfractal@iii(#1)}{\psfractal@iii(#1)(1,1)}}%
@@ -146,54 +359,29 @@
\end@OpenObj%
}
%
-\def\psSier@vi{% Siepinski curve
+\def\psSier@vi{% Sierpinski curve
+ \addbefore@par{n=3,N=all,dotcolor=red}%
\begin@SpecialObj
\addto@pscode{
+ /useFill \ifx\psk@fillstylename\@none false \else true \fi def
+ /fillColor { \pst@usecolor\psfillcolor } def
+% \else
+% /useFillColor { 
+% \ifx\psk@fillstylename\@none
+% \else
+% gsave \pst@usecolor\psfillcolor fill grestore
+% \fi
+% } def
+ /useLineStyle { \ifx\pslinestyle\@none\else \psls@solid stroke \fi } def
/n@ \pst@fractal@n def
/NbrePts (\pst@fractal@N) def
+ /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
- /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
+ tx@fractalDict begin tx@SierpinskiCurve
\ifshowpoints
- 0 2 Sierpinsky length 2 sub {/i exch def
+ 0 2 Sierpinsky length 2 sub {
+ /i exch def
i 2 div Npts ge {exit} if
Sierpinsky i get
Sierpinsky i 1 add get