NAME
Math::PlanePath::FibonacciWordFractal  turns by Fibonacci word bits
SYNOPSIS
use Math::PlanePath::FibonacciWordFractal;
my $path = Math::PlanePath::FibonacciWordFractal>new;
my ($x, $y) = $path>n_to_xy (123);
DESCRIPTION
This is an integer version of the Fibonacci word fractal
Alexis MonnerotDumaine, "The Fibonacci Word Fractal", February 2009. http://hal.archivesouvertes.fr/hal00367972_v1/ http://hal.archivesouvertes.fr/docs/00/36/79/72/PDF/The_Fibonacci_word_fractal.pdf
It makes turns controlled by the "Fibonacci word" sequence, sometimes called the "golden string".
11  272829 333435 535455 596061
        
10  26 303132 36 52 565758 62
    
9  2524 3837 5150 6463
    
8  23 39 434445 49 65
      
7  2122 404142 464748 6667
  
6  20 161514 747372 68
      
5  191817 13 75 717069
  
4  1112 7677
  
3  10 78
  
2  98 8079
  
1  123 7 81 858687
      
Y=0  0 456 828384 8889...
+
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
A current direction up,down,left,right is maintained, starting in the up direction. The path moves in the current direction and then may turn or go straight according to the Fibonacci word,
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 draw a line upwards to N=1 and the first Fibonacci word value is 0 and its position index=1 is odd so 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 selfsimilar 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.
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
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
$path = Math::PlanePath::FibonacciWordFractal>new ()

Create and return a new path object.
($x,$y) = $path>n_to_xy ($n)

Return the X,Y coordinates of point number
$n
on the path. Points begin at 0 and if$n < 0
then the return is an empty list.Fractional positions give an X,Y position along a straight line between the integer positions.
$n = $path>n_start()

Return 0, the first N in the path.
OEIS
Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include,
http://oeis.org/A156596 (etc)
A156596  turn sequence, 0=straight,1=right,2=left
A171587  abs(dX), so 1=horizontal,0=vertical
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
SEE ALSO
Math::PlanePath, Math::PlanePath::DragonCurve, Math::PlanePath::WythoffArray
HOME PAGE
http://user42.tuxfamily.org/mathplanepath/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014, 2015, 2016 Kevin Ryde
This file is part of MathPlanePath.
MathPlanePath 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.
MathPlanePath 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 MathPlanePath. If not, see <http://www.gnu.org/licenses/>.