Math::...Fractal(3pm)
π Math::PlanePath::FibonacciWordFractal π
okay bestie, sit DOWN, because this is the Math::PlanePath::FibonacciWordFractal page from the User Contributed Perl Documentation (that's the Math::...Fractal(3pm) vibe you clicked on), and it's literally a fractal that turns by Fibonacci word bits and it is SO much cooler than it sounds π¦
β¨ NAME β¨
Math::PlanePath::FibonacciWordFractal β turns by Fibonacci word bits. that's it, that's the whole gig, and it slays π
πΈ SYNOPSIS πΈ
use Math::PlanePath::FibonacciWordFractal;
my $path = Math::PlanePath::FibonacciWordFractal->new;
my ($x, $y) = $path->n_to_xy (123);
three lines. that's your whole entry point. go off π
π§ DESCRIPTION π§
so this is an integer version of the Fibonacci word fractal, and the source of truth here is:
Alexis Monnerot-Dumaine, "The Fibonacci Word Fractal", March 2009.
<https://hal.archives-ouvertes.fr/hal-00367972/>
It makes turns controlled by the "Fibonacci word" sequence, which some people call the "golden string" (main character naming energy honestly).
here's what the path actually looks like, no cap:
11 | 27-28-29 33-34-35 53-54-55 59-60-61
| | | | | | | | |
10 | 26 30-31-32 36 52 56-57-58 62
| | | | |
9 | 25-24 38-37 51-50 64-63
| | | | |
8 | 23 39 43-44-45 49 65
| | | | | | |
7 | 21-22 40-41-42 46-47-48 66-67
| | |
6 | 20 16-15-14 74-73-72 68
| | | | | | |
5 | 19-18-17 13 75 71-70-69
| | |
4 | 11-12 76-77
| | |
3 | 10 78
| | |
2 | 9--8 80-79
| | |
1 | 1--2--3 7 81 85-86-87
| | | | | | |
Y=0 | 0 4--5--6 82-83-84 88-89-...
+-------------------------------------------------------
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
okay so the way this works: a current direction β up, down, left, right β is maintained, and it starts in the up direction. the path moves in the current direction and then it may turn or go straight according to the Fibonacci word, like:
Fib word
--------
0 turn left if even index, right if odd index
1 straight ahead
the Fibonacci word is reckoned as starting from index=1, so for example at N=0 you draw a line upwards to N=1 and the first Fibonacci word value is 0 and its position index=1 is odd so you turn to the right. π
N Fibonacci word
--- --------------
1 0 turn right
2 1
3 0 turn right
4 0 turn left
5 1
6 0 turn left
7 1
the result is self-similar blocks within the first quadrant X>=0,Y>=0. new blocks extend at N values which are Fibonacci numbers. for example N=21 a new block begins above, then N=34 a new block across, N=55 down, N=89 across again, etc. iconic behavior fr fr.
the new blocks are a copy of the shape starting N=0 but rotated and/or transposed according to the replication level mod 6:
level mod 6 new block
----------- ---------
0 transpose
1 rotate -90
2 transpose and rotate -90
3 transpose
4 rotate +90
5 transpose and rotate +90
π FUNCTIONS π
peep "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes β that's the shared lore, iykyk.
"$path = Math::PlanePath::FibonacciWordFractal->new ()"β create and return a new path object. your lil baby path π«Ά"($x,$y) = $path->n_to_xy ($n)"β return the X,Y coordinates of point number$non the path. Points begin at0and if"$n < 0"then the return is an empty list. yes, empty. nothing. void. π
Fractional positions give an X,Y position along a straight line between the integer positions β so you can vibe in between, it's fine.
"$n = $path->n_start()"β return0, the first N in the path. zero. the beginning. the origin story β¨
π₯ OEIS π₯
entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include,
<http://oeis.org/A156596> (etc)
A332298 X coordinate, starting at n=1
A332299 Y-1 coordinate, starting at n=1
A156596 turn sequence, 0=straight,1=right,2=left
A143668 turn sequence, 0=right,1=straight,2=left
A171587 abs(dX), so 1=horizontal,0=vertical
A265318 N at locations by diagonals
A003849 Fibonacci word with values 0,1
A005614 Fibonacci word with values 1,0
A003842 Fibonacci word with values 1,2
A014675 Fibonacci word with values 2,1
a whole reading list. nerd out bestie, no one's stopping you π
π SEE ALSO π
Math::PlanePathMath::PlanePath::DragonCurveMath::PlanePath::WythoffArrayMath::NumSeq::FibonacciWord
π HOME PAGE π
<http://user42.tuxfamily.org/math-planepath/index.html>
go click it, the vibes are immaculate.
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde
This file is part of Math-PlanePath.
Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
β οΈ okay so real talk, that warranty disclaimer is NOT a joke β no warranty, no promises, read the license fr fr.
and that's the whole page, bestie π₯° this was perl v5.32.0, dated 2021-01-23, straight from the Math::...Fractal(3pm) corner of the manual. go draw some turns, you absolute icon π
β¨π¦
π¦ where this page comes from
- debian bookworm: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- debian trixie: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu jammy: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu noble: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu resolute: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu stonking: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms