1Math::PlanePath::FibonaUcsceirWoCrodnFtrraicbtuatle(d3M)Paetrhl::DPolcaunmeePnattaht:i:oFnibonacciWordFractal(3)
2
3
4
6 Math::PlanePath::FibonacciWordFractal -- turns by Fibonacci word bits
7
9 use Math::PlanePath::FibonacciWordFractal;
10 my $path = Math::PlanePath::FibonacciWordFractal->new;
11 my ($x, $y) = $path->n_to_xy (123);
12
14 This is an integer version of the Fibonacci word fractal
15
16 Alexis Monnerot-Dumaine, "The Fibonacci Word Fractal", March 2009.
17 <https://hal.archives-ouvertes.fr/hal-00367972/>
18
19 It makes turns controlled by the "Fibonacci word" sequence, sometimes
20 called the "golden string".
21
22 11 | 27-28-29 33-34-35 53-54-55 59-60-61
23 | | | | | | | | |
24 10 | 26 30-31-32 36 52 56-57-58 62
25 | | | | |
26 9 | 25-24 38-37 51-50 64-63
27 | | | | |
28 8 | 23 39 43-44-45 49 65
29 | | | | | | |
30 7 | 21-22 40-41-42 46-47-48 66-67
31 | | |
32 6 | 20 16-15-14 74-73-72 68
33 | | | | | | |
34 5 | 19-18-17 13 75 71-70-69
35 | | |
36 4 | 11-12 76-77
37 | | |
38 3 | 10 78
39 | | |
40 2 | 9--8 80-79
41 | | |
42 1 | 1--2--3 7 81 85-86-87
43 | | | | | | |
44 Y=0 | 0 4--5--6 82-83-84 88-89-...
45 +-------------------------------------------------------
46 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
47
48 A current direction up,down,left,right is maintained, starting in the
49 up direction. The path moves in the current direction and then may
50 turn or go straight according to the Fibonacci word,
51
52 Fib word
53 --------
54 0 turn left if even index, right if odd index
55 1 straight ahead
56
57 The Fibonacci word is reckoned as starting from index=1, so for example
58 at N=0 draw a line upwards to N=1 and the first Fibonacci word value is
59 0 and its position index=1 is odd so turn to the right.
60
61 N Fibonacci word
62 --- --------------
63 1 0 turn right
64 2 1
65 3 0 turn right
66 4 0 turn left
67 5 1
68 6 0 turn left
69 7 1
70
71 The result is self-similar blocks within the first quadrant X>=0,Y>=0.
72 New blocks extend at N values which are Fibonacci numbers. For example
73 N=21 a new block begins above, then N=34 a new block across, N=55 down,
74 N=89 across again, etc.
75
76 The new blocks are a copy of the shape starting N=0 but rotated and/or
77 transposed according to the replication level mod 6,
78
79 level mod 6 new block
80 ----------- ---------
81 0 transpose
82 1 rotate -90
83 2 transpose and rotate -90
84 3 transpose
85 4 rotate +90
86 5 transpose and rotate +90
87
89 See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
90 classes.
91
92 "$path = Math::PlanePath::FibonacciWordFractal->new ()"
93 Create and return a new path object.
94
95 "($x,$y) = $path->n_to_xy ($n)"
96 Return the X,Y coordinates of point number $n on the path. Points
97 begin at 0 and if "$n < 0" then the return is an empty list.
98
99 Fractional positions give an X,Y position along a straight line
100 between the integer positions.
101
102 "$n = $path->n_start()"
103 Return 0, the first N in the path.
104
106 Entries in Sloane's Online Encyclopedia of Integer Sequences related to
107 this path include,
108
109 <http://oeis.org/A156596> (etc)
110
111 A332298 X coordinate, starting at n=1
112 A332299 Y-1 coordinate, starting at n=1
113 A156596 turn sequence, 0=straight,1=right,2=left
114 A143668 turn sequence, 0=right,1=straight,2=left
115 A171587 abs(dX), so 1=horizontal,0=vertical
116 A265318 N at locations by diagonals
117
118 A003849 Fibonacci word with values 0,1
119 A005614 Fibonacci word with values 1,0
120 A003842 Fibonacci word with values 1,2
121 A014675 Fibonacci word with values 2,1
122
124 Math::PlanePath, Math::PlanePath::DragonCurve,
125 Math::PlanePath::WythoffArray
126
127 Math::NumSeq::FibonacciWord
128
130 <http://user42.tuxfamily.org/math-planepath/index.html>
131
133 Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
134 Kevin Ryde
135
136 This file is part of Math-PlanePath.
137
138 Math-PlanePath is free software; you can redistribute it and/or modify
139 it under the terms of the GNU General Public License as published by
140 the Free Software Foundation; either version 3, or (at your option) any
141 later version.
142
143 Math-PlanePath is distributed in the hope that it will be useful, but
144 WITHOUT ANY WARRANTY; without even the implied warranty of
145 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
146 General Public License for more details.
147
148 You should have received a copy of the GNU General Public License along
149 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
150
151
152
153perl v5.38.0 2023-M0a7t-h2:0:PlanePath::FibonacciWordFractal(3)