summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro')
-rw-r--r--Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro433
1 files changed, 398 insertions, 35 deletions
diff --git a/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro b/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro
index 5493d734a73..f0f0de007e9 100644
--- a/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro
+++ b/Master/texmf-dist/dvips/pst-fractal/pst-fractal.pro
@@ -1,4 +1,4 @@
-%% $Id: pst-fractal.pro 659 2017-11-26 16:58:16Z herbert $
+%% $Id: pst-fractal.pro 673 2017-12-02 22:04:41Z herbert $
%%
%% This is file `pst-fractal.pro',
%%
@@ -16,7 +16,7 @@
%% `pst-fractal' is a PSTricks package to draw fractal objects
%%
%%
-%% version 0.04 / 2017-11-26 Herbert Voss <hvoss _at_ tug.org>
+%% version 0.05 / 2017-12-02 Herbert Voss <hvoss _at_ tug.org>
%
/tx@fractalDict 100 dict def
tx@fractalDict begin
@@ -130,16 +130,6 @@ 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
@@ -148,12 +138,11 @@ tx@fractalDict begin
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
+/tx@SierpinskiCurve { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ /Pi [1.5 cmunit 1 cmunit
+ 1 cmunit 0.5 cmunit
+ 1 cmunit -0.5 cmunit
+ 1.5 cmunit -1 cmunit ] def
%
/P0 Pi def
/coefficient 1 def
@@ -164,40 +153,77 @@ tx@fractalDict begin
Pi i get Pi i 1 add get Rot-90
} for
] /Pi exch def
- P0 Pi append /P0 exch def
- } repeat
+ P0 Pi concatarray /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
+ -2 cmunit coefficient mul add exch
+ -2 cmunit 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
+ 0 2 P0 length 2 sub {
+ /i exch def
+ P0 i get P0 i 1 add get Rot-90
+ 2 cmunit coefficient mul add exch
+ -2 cmunit 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
+ 0 2 P0 length 2 sub {
+ /i exch def
+ P0 i get P0 i 1 add get Rot-90 Rot-90
+ 2 cmunit coefficient mul add exch
+ 2 cmunit 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
+ -2 cmunit coefficient mul add exch
+ 2 cmunit coefficient mul add exch
} for
] } def
+ n@ 1 eq {/Sierpinsky P0 def}{
+ n@ 1 sub {
+ /Sierpinsky P1 P2 concatarray P3 concatarray P4 concatarray 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
+ useFill { gsave fillColor fill grestore } if
+%
+ useLineStyle
} def
%
/tx@Phyllotaxis { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -518,4 +544,341 @@ realtime srand
drawfractal
} def % end of /tx@Hugo
%
+/FibonacciFractal {
+ 20 dict begin
+ n@ 2 sub {
+ /Fi F2 F1 concatstrings def
+ /F1 F2 def
+ /F2 Fi def
+ } repeat
+ /S Fi def
+ /nS S length def % nombre de lettres
+ 0 1 nS 2 sub {/j exch def
+ x1 y1 translate
+ /x0 0 def /y0 0 def
+ /k S j 1 getinterval cvi def
+ k 0 eq {
+ j 2 mod 0 eq {
+ angle neg rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ /flag 0 def
+ }{
+ angle rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ /flag 1 def
+ } ifelse
+ }{
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ /flag 2 def
+ } ifelse
+ } for
+ setLineColor
+ stroke
+ Pst@juxtaposition {
+ x1 y1 translate
+ flag 1 eq {-1 1 scale} if
+ flag 2 eq {90 rotate 1 -1 scale } if
+ 0 0 moveto
+ /x0 0 def /y0 0 def
+ /F1 (1) def
+ /F2 (0) def
+ /x1 0 def /y1 1 cmunit def
+ x1 y1 lineto
+ n@ 3 sub{
+ /Fi F2 F1 concatstrings def
+ /F1 F2 def
+ /F2 Fi def
+ } repeat
+ /S Fi def
+ /nS S length def % nombre de lettres
+ 0 1 nS 2 sub {/j exch def
+ x1 y1 translate
+ /x0 0 def /y0 0 def
+ /k S j 1 getinterval cvi def
+ k 0 eq {
+ j 2 mod 0 eq {
+ -90 rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }{
+ 90 rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } ifelse
+ }{
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } ifelse
+ } for
+ ColorF
+ stroke
+ } if % end Pst@juxtaposition
+ end
+} def
+%
+/newFibonacciFractal {
+ 20 dict begin
+ n@ 2 sub {
+ /Fi F2 F1 concatstrings def
+ /F1 F2 def
+ /F2 Fi def
+ } repeat
+ % The Dense Fibonacci Word
+ /DFW () def
+ 0 2 F2 length 2 sub {
+ /i exch def
+ /I F2 i 2 getinterval def
+ I (00) eq {DFW (0) concatstrings /DFW exch def } if
+ I (01) eq {DFW (1) concatstrings /DFW exch def } if
+ I (10) eq {DFW (2) concatstrings /DFW exch def } if
+ } for
+% morphismes
+% newFibonacci
+% 0->"", 1->1, 2->2
+ /F2 DFW def
+ /Fi () def
+ 0 1 F2 length 1 sub {
+ /i exch def
+ /I F2 i 1 getinterval def
+ I (0) eq {Fi m@0 concatstrings /Fi exch def} if
+ I (1) eq {Fi m@1 concatstrings /Fi exch def} if
+ I (2) eq {Fi m@2 concatstrings /Fi exch def} if
+ } for
+ /S Fi def
+ /nS S length def % nombre de lettres
+ 0 1 nS 1 sub {
+ /j exch def
+ x1 y1 translate
+ /x0 0 def /y0 0 def
+ /k S j 1 getinterval cvi def
+ k 1 eq {angle neg rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } if
+ k 2 eq { angle rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } if
+ k 0 eq {
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } if
+ } for
+ setLineColor
+ stroke
+ end
+} def
+%
+/i-FibonacciFractal {
+ 20 dict begin
+ /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
+ /S Fi def
+ 0 0 translate
+ 0 0 moveto
+ currentpoint /y0 exch def /x0 exch def
+ 0 1 cmunit lineto
+ currentpoint /y1 exch def /x1 exch def
+ /tx {x1 x0 sub} def
+ /ty {y1 y0 sub} def
+%
+ /nS S length def % nombre de lettres
+ 0 1 nS 2 sub {
+ /j exch def
+ x1 y1 translate
+ /x0 0 def /y0 0 def
+ /k S j 1 getinterval cvi def
+ k 0 eq {
+ j 2 mod 0 eq {
+ angle neg rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }{
+ angle rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } ifelse
+ }{
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } ifelse
+ } for
+ setLineColor
+ stroke
+ end
+} def
+%
+/k-FibonacciFractal {
+ 20 dict begin
+ /f0 (0) def
+ /fi (0) def
+ k@ 2 sub {
+ fi (0) concatstrings /fi exch def
+ } repeat
+ fi (1) concatstrings
+ /f1 exch def
+ /fi f1 def
+ n@ 1 sub {
+ k@ 1 sub { f1 fi concatstrings /f1 exch def } repeat
+ f1 f0 concatstrings /f1 exch def
+ /f0 fi def
+ /fi f1 def
+ } repeat
+ /S f1 def
+ t@x cmunit_1 28.45 mul t@y cmunit_1 28.45 mul translate
+ 0 0 moveto
+ currentpoint /y0 exch def /x0 exch def
+ 0 1 cmunit lineto
+ currentpoint /y1 exch def /x1 exch def
+ /tx {x1 x0 sub} def
+ /ty {y1 y0 sub} def
+ /nS S length def % nombre de lettres
+ 0 1 nS 1 sub {/j exch def
+ x1 y1 translate
+ /x0 0 def /y0 0 def
+ /k S j 1 getinterval cvi def
+ k 0 eq {
+ j 2 mod 0 eq {
+ angle neg rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }
+ {
+ angle rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }
+ ifelse
+} {
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ } ifelse
+ } for
+ setLineColor
+ stroke
+ end
+} def
+%
+/Biperiodic-FibonacciWords {
+ 20 dict begin
+/f0 () def
+/f1 (0) def
+/f2 a@ 1 sub {(0) f0 concatstrings /f0 exch def} repeat f0 (1) concatstrings def
+3 1 n@ {/i exch def
+/fi () def
+i 2 mod 0 eq {
+ a@ { fi f2 concatstrings /fi exch def } repeat
+ }{
+ b@ { fi f2 concatstrings /fi exch def } repeat
+ } ifelse
+ fi f1 concatstrings /fi exch def
+ /f1 f2 def
+ /f2 fi def
+} for
+/S f2 def
+t@x cmunit_1 28.45 mul t@y cmunit_1 28.45 mul translate
+0 0 moveto
+currentpoint /y0 exch def /x0 exch def
+1 cmunit 0 cmunit lineto
+currentpoint /y1 exch def /x1 exch def
+/tx {x1 x0 sub} def
+/ty {y1 y0 sub} def
+/nS S length def % nombre de lettres
+0 1 nS 1 sub {/j exch def
+x1 y1 translate
+/x0 0 def /y0 0 def
+/k S j 1 getinterval cvi def
+k 0 eq {
+j 2 mod 0 eq {
+ angle neg rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }
+ {
+ angle rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }
+ ifelse
+} {
+tx ty lineto
+currentpoint /y1 exch def /x1 exch def
+} ifelse
+} for
+ setLineColor
+stroke
end
+ }def
+%
+/InverseLR {
+ 1 dict begin
+ /str exch def
+ 0 1 str length 1 sub {/i exch def
+ str i 1 getinterval (L) eq {str i (R) putinterval }{str i (L) putinterval }ifelse
+ } for
+ str
+ end
+} def
+%
+/FibonacciPolyominoes {
+ 20 dict begin
+ gsave
+ t@x t@y translate
+ /q0 () def
+ /q1 (R) def
+ /N n@ 3 mul 1 add def
+ 2 1 N {
+ /n exch def
+ n 3 mod 2 eq {/qi q1 q0 concatstrings def}
+ {/qi q1 q0 InverseLR concatstrings def} ifelse
+ /q0 q1 def
+ /q1 qi def
+ } for
+ /q_1 q1 reversestring def
+ /qii () def
+ /Q 3 {qii q1 concatstrings /qii exch def } repeat
+ qii q_1 reversestring concatstrings def
+% remarque
+% identique /Q 4{qii q1 concatstrings /qii exch def} repeat qii def
+ /tx {x1 x0 sub} def
+ /ty {y1 y0 sub} def
+ /y0 0 def /x0 0 def
+ /x1 x0 0 cmunit add def /y1 y0 1 cmunit add def
+ newpath
+ x0 y0 moveto
+ x1 y1 lineto
+ 0 1 Q length 1 sub {/i exch def
+ x1 y1 translate
+ Q i 1 getinterval (L) eq {
+ 90 rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }{
+ 90 neg rotate
+ tx ty lineto
+ currentpoint /y1 exch def /x1 exch def
+ }ifelse
+ } for
+ closepath
+ setFillColor
+ setLineColor
+ grestore
+ end
+} def
+
+%
+end \ No newline at end of file