.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Math::PlanePath::GosperSide 3pm" .TH Math::PlanePath::GosperSide 3pm "2018-03-18" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::GosperSide \-\- one side of the Gosper island .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::GosperSide; \& my $path = Math::PlanePath::GosperSide\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This path is a single side of the Gosper island, in integers (\*(L"Triangular Lattice\*(R" in Math::PlanePath). .IX Xref "Gosper, William" .PP .Vb 10 \& 20\-... 14 \& / \& 18\-\-\-\-19 13 \& / \& 17 12 \& \e \& 16 11 \& / \& 15 10 \& \e \& 14\-\-\-\-13 9 \& \e \& 12 8 \& / \& 11 7 \& \e \& 10 6 \& / \& 8\-\-\-\- 9 5 \& / \& 6\-\-\-\- 7 4 \& / \& 5 3 \& \e \& 4 2 \& / \& 2\-\-\-\- 3 1 \& / \& 0\-\-\-\- 1 <\- Y=0 \& \& ^ \& X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 ... .Ve .PP The path slowly spirals around counter clockwise, with a lot of wiggling in between. The N=3^level point is at .PP .Vb 4 \& N = 3^level \& angle = level * atan(sqrt(3)/5) \& = level * 19.106 degrees \& radius = sqrt(7) ^ level .Ve .PP A full revolution for example takes roughly level=19 which is about N=1,162,000,000. .PP Both ends of such levels are in fact sub-spirals, like an \*(L"S\*(R" shape. .PP The path is both the sides and the radial spokes of the \f(CW\*(C`GosperIslands\*(C'\fR path, as described in \*(L"Side and Radial Lines\*(R" in Math::PlanePath::GosperIslands. Each N=3^level point is the start of a \f(CW\*(C`GosperIslands\*(C'\fR ring. .PP The path is the same as the \f(CW\*(C`TerdragonCurve\*(C'\fR except the turns here are by 60 degrees each, whereas \f(CW\*(C`TerdragonCurve\*(C'\fR is by 120 degrees. See Math::PlanePath::TerdragonCurve for the turn sequence and total direction formulas etc. .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::GosperSide\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::GosperSide\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::GosperSide->new ()" Create and return a new path object. .ie n .IP """($x,$y) = $path\->n_to_xy ($n)""" 4 .el .IP "\f(CW($x,$y) = $path\->n_to_xy ($n)\fR" 4 .IX Item "($x,$y) = $path->n_to_xy ($n)" Return the X,Y coordinates of point number \f(CW$n\fR on the path. Points begin at 0 and if \f(CW\*(C`$n < 0\*(C'\fR then the return is an empty list. .Sp Fractional \f(CW$n\fR gives a point on the straight line between integer N. .SS "Level Methods" .IX Subsection "Level Methods" .ie n .IP """($n_lo, $n_hi) = $path\->level_to_n_range($level)""" 4 .el .IP "\f(CW($n_lo, $n_hi) = $path\->level_to_n_range($level)\fR" 4 .IX Item "($n_lo, $n_hi) = $path->level_to_n_range($level)" Return \f(CW\*(C`(0, 3**$level)\*(C'\fR. .SH "FORMULAS" .IX Header "FORMULAS" .SS "Level Endpoint" .IX Subsection "Level Endpoint" The endpoint of each level N=3^k is at .PP .Vb 3 \& X + Y*i*sqrt(3) = b^k \& where b = 2 + w = 5/2 + sqrt(3)/2*i \& where w=1/2 + sqrt(3)/2*i sixth root of unity \& \& X(k) = ( 5*X(k\-1) \- 3*Y(k\-1) )/2 for k>=1 \& Y(k) = ( X(k\-1) + 5*Y(k\-1) )/2 \& starting X(0)=2 Y(0)=0 \& \& X(k) = 5*X(k\-1) \- 7*X(k\-2) for k>=2 \& starting X(0)=2 X(1)=5 \& = 2, 5, 11, 20, 23, \-25, \-286, \-1255, \-4273, \-12580, \-32989,.. \& \& Y(k) = 5*Y(k\-1) \- Y*X(k\-2) for k>=2 \& starting Y(0)=0 Y(1)=1 \& = 0, 1, 5, 18, 55, 149, 360, 757, 1265, 1026, \-3725, ... \& (A099450) .Ve .PP The curve base figure is \s-1XY\s0(k)=XY(k\-1)+rot60(\s-1XY\s0(k\-1))+XY(k\-1) giving \s-1XY\s0(k) = (2+w)^k = b^k where w is the sixth root of unity giving the rotation by +60 degrees. .PP The mutual recurrences are similar with the rotation done by (X\-3Y)/2, (Y+X)/2 per \*(L"Triangular Lattice\*(R" in Math::PlanePath. The separate recurrences are found by using the first to get Y(k\-1) = \-2/3*X(k) + 5/3*X(k\-1) and substitute into the other to get X(k+1). Similar the other way around for Y(k+1). .SH "OEIS" .IX Header "OEIS" Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include .Sp .RS 4 (etc) .RE .PP .Vb 2 \& A229215 direction 1,2,3,\-1,\-2,\-3 (clockwise) \& A099450 Y at N=3^k (for k>=1) .Ve .PP Also the turn sequence is the same as the terdragon curve, see \&\*(L"\s-1OEIS\*(R"\s0 in Math::PlanePath::TerdragonCurve for the several turn forms, N positions of turns, etc. .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::GosperIslands, Math::PlanePath::TerdragonCurve, Math::PlanePath::KochCurve .PP Math::Fractal::Curve .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 Kevin Ryde .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .