NAME
Math::PlanePath::MathImageGosperReplicate -- self-similar hexagon replications
SYNOPSIS
use Math::PlanePath::MathImageGosperReplicate;
my $path = Math::PlanePath::MathImageGosperReplicate->new;
my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION
In progress ...
This path is a self-similar hexagonal tiling of the plane. At each level the shape is the Gosper island.
17----- 16 4
/ \
24----- 23 18 14----- 15 3
/ \ \
25 21----- 22 19----- 20 10----- 9 2
\ / \
26----- 27 3----- 2 11 7----- 8 1
/ \ \
31----- 30 4 0----- 1 12----- 13 <- Y=0
/ \ \
32 28----- 29 5----- 6 45----- 44 -1
\ / \
33----- 34 38----- 37 46 42----- 43 -2
/ \ \
39 35----- 36 47----- 48 -3
\
40----- 41 -4
^
-7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7
arranged as concentric rings on .
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 basic pattern is the inner N=0 to N=6, then six copies of that shape are arranged around as the N=7,14,21,28,35,42 blocks. Then six copies of the N=0 to N=48 shape are replicated around, etc.
The inner N=0 to N=6 are a hexagon, but the individual points can be taken to represent hexagons to tile the plane,
* *
/ \ / \
/ \ / \
* * *
| 3 | 2 |
* * *
/ \ / \ / \
/ \ / \ / \
* * * *
| 4 | 0 | 1 |
* * * *
\ / \ / \ /
\ / \ / \ /
* * *
| 5 | 6 |
* * *
\ / \ /
\ / \ /
* *
The FlowsnakeCentres uses this same replication shape, but starting from a side instead of the middle and with rotations and reflections which make it join up. Notice for instance N=6 and N=7 here are not adjacent, whereas in the FlowsnakeCentres they are. The Flowsnake curve itself is this replication too, but following edges.
Complex Base
This path corresponds to expressing complex integers X+i*Y in a base b=5/2+i*sqrt(3)/2 with a bit of scaling to fit equilateral triangles to a square grid,
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 and is encoded into N as base 7 integer digits,
N digit a[i]
0 0
1 e^(0/6 * 2pi * i) = 1
2 e^(1/6 * 2pi * i) = 1/2 + i*sqrt(3)/2
3 e^(2/6 * 2pi * i) = -1/2 + i*sqrt(3)/2
4 e^(3/6 * 2pi * i) = -1
5 e^(4/6 * 2pi * i) = -1/2 - i*sqrt(3)/2
6 e^(5/6 * 2pi * i) = 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 the behaviour common to all path classes.
$path = Math::PlanePath::MathImageGosperReplicate->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::QuintetReplicate, Math::PlanePath::Flowsnake, Math::PlanePath::FlowsnakeCentres