Math::PlanePath::GosperReplicate(3pm) | User Contributed Perl Documentation | Math::PlanePath::GosperReplicate(3pm) |
NAME¶
Math::PlanePath::GosperReplicate -- self-similar hexagon replicationsSYNOPSIS¶
use Math::PlanePath::GosperReplicate; my $path = Math::PlanePath::GosperReplicate->new; my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION¶
This 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
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 baseb = 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.
Level Methods¶
- "($n_lo, $n_hi) = $path->level_to_n_range($level)"
- Return "(0, 7**$level - 1)".
SEE ALSO¶
Math::PlanePath, Math::PlanePath::GosperIslands, Math::PlanePath::Flowsnake, Math::PlanePath::FlowsnakeCentres, Math::PlanePath::QuintetReplicate, Math::PlanePath::ComplexPlusHOME PAGE¶
<http://user42.tuxfamily.org/math-planepath/index.html>LICENSE¶
Copyright 2011, 2012, 2013, 2014, 2015, 2016 Kevin RydeThis 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/>.
2016-05-03 | perl v5.22.2 |