NAME
Math::PlanePath::GosperReplicate  selfsimilar hexagon replications
SYNOPSIS
use Math::PlanePath::GosperReplicate;
my $path = Math::PlanePath::GosperReplicate>new;
my ($x, $y) = $path>n_to_xy (123);
DESCRIPTION
This is a selfsimilar hexagonal tiling of the plane. At each level the shape is the Gosper island.
1716 4
/ \
2423 18 1415 3
/ \ \
25 2122 1920 10 9 2
\ / \
2627 3 2 11 7 8 1
/ \ \
3130 4 0 1 1213 < Y=0
/ \ \
32 2829 5 6 4544 1
\ / \
3334 3837 46 4243 2
/ \ \
39 3536 4748 3
\
4041 4
^
7 6 5 4 3 2 1 X=0 1 2 3 4 5 6 7
The points are spread out on every second X coordinate to make a a triangular lattice in integer coordinates (see "Triangular Lattice" in Math::PlanePath).
The base pattern is the inner N=0 to N=6, then six copies of that shape are arranged around as the blocks N=7,14,21,28,35,42. Then six copies of the resulting N=0 to N=48 shape are replicated around, etc.
Each point represents a little hexagon, thus tiling the plane with hexagons. The innermost N=0 to N=6 are for instance,
* *
/ \ / \
/ \ / \
* * *
 3  2 
* * *
/ \ / \ / \
/ \ / \ / \
* * * *
 4  0  1 
* * * *
\ / \ / \ /
\ / \ / \ /
* * *
 5  6 
* * *
\ / \ /
\ / \ /
* *
The further replications are the same arrangement, but the sides become ever wigglier and the centres rotate around. The rotation can be seen at N=7 X=5,Y=1 which is up from the X axis.
The FlowsnakeCentres
path is this same replicating shape, but starting from a side instead of the middle and traversing in such as way as to make each N adjacent. The Flowsnake
curve itself is this replication too, but following edges.
Complex Base
The path corresponds to expressing complex integers X+i*Y in a base
b = 5/2 + i*sqrt(3)/2
with some scaling to put equilateral triangles on a square grid. So for integer X,Y with X and Y either both odd or both even,
X/2 + i*Y*sqrt(3)/2 = a[n]*b^n + ... + a[2]*b^2 + a[1]*b + a[0]
where each digit a[i] is either 0 or a sixth root of unity encoded into N as base 7 digits,
r = e^(i*pi/3)
= 1/2 + i*sqrt(3)/2 sixth root of unity
N digit a[i] complex number
 
0 0
1 r^0 = 1
2 r^2 = 1/2 + i*sqrt(3)/2
3 r^3 = 1/2 + i*sqrt(3)/2
4 r^4 = 1
5 r^5 = 1/2  i*sqrt(3)/2
6 r^6 = 1/2  i*sqrt(3)/2
7 digits suffice because
norm(b) = (5/2)^2 + (sqrt(3)/2)^2 = 7
FUNCTIONS
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
$path = Math::PlanePath::GosperReplicate>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.
SEE ALSO
Math::PlanePath, Math::PlanePath::GosperIslands, Math::PlanePath::Flowsnake, Math::PlanePath::FlowsnakeCentres, Math::PlanePath::QuintetReplicate, Math::PlanePath::ComplexPlus
HOME PAGE
http://user42.tuxfamily.org/mathplanepath/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014 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/>.