NAME
Math::PlanePath::AlternatePaperMidpoint  alternate paper folding midpoints
SYNOPSIS
use Math::PlanePath::AlternatePaperMidpoint;
my $path = Math::PlanePath::AlternatePaperMidpoint>new;
my ($x, $y) = $path>n_to_xy (123);
DESCRIPTION
This is the midpoints of each alternate paper folding curve (Math::PlanePath::AlternatePaper).
8  6465...
 
7  63
 
6  2021 62
   
5  19 22 616059
   
4  161718 23 565758
   
3  15 262524 55 50494847
     
2  45 14 272829 54 51 3637 46
         
1  3 6 131211 30 5352 35 38 454443
       
Y=0  012 78910 31323334 39404142
+
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
The AlternatePaper
curve begins as follows and the midpoints are numbered from 0,

9

8
 
7 
 
2 6
  
1 3 5
  
*0 4
These midpoints are on fractions X=0.5,Y=0, X=1,Y=0.5, etc. For this AlternatePaperMidpoint
they're turned 45 degrees and mirrored so the 0,1,2 upward diagonal becomes horizontal along the X axis, and the 2,3,4 downward diagonal becomes a vertical at X=2, extending to X=2,Y=2 at N=4.
The midpoints are distinct X,Y positions because the alternate paper curve traverses each edge only once.
The curve is selfsimilar in 2^level sections due to its unfolding. This can be seen in the midpoints as for example N=0 to N=16 above is the same shape as N=16 to N=32, but the latter rotated +90 degrees and numbered in reverse.
Arms
The midpoints fill an eighth of the plane and eight copies can mesh together perfectly when mirrored and rotated by 90, 180 and 270 degrees. The arms
parameter can choose 1 to 8 curve arms successively advancing.
For example arms => 8
begins as follows. N=0,8,16,24,etc is the first arm, the same as the plain curve above. N=1,9,17,25 is the second, N=2,10,18,26 the third, etc.
9082 8189 7
arms => 8    
... 74 73 ... 6
 
66 65 5
 
4335 425058 574941 4
   
91.. 51 27 342618 172533 3
    
83756759 19113 10 9 3240 2
   
84766860 20124 2 1 24 48 ..88 1
     
92.. 52 28 5 6 0816 56647280 < Y=0
   
4436 13 14 71523 63717987 1
    
372921 223038 31 55 ..95 2
   
455361 625446 3947 3
 
69 70 4
 
... 77 78 ... 5
   
9385 8694 6
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
7 6 5 4 3 2 1 X=0 1 2 3 4 5 6
With eight arms like this every X,Y point is visited exactly once, because the 8arm AlternatePaper
traverses every edge exactly once ("Arms" in Math::PlanePath::AlternatePaper).
The arm numbering doesn't correspond to the AlternatePaper
, due to the rotate and reflect of the first arm. It ends up arms 0 and 1 of the AlternatePaper
corresponding to arms 7 and 0 of the midpoints here, those two being a pair going horizontally corresponding to a pair in the AlternatePaper
going diagonally into a quadrant.
FUNCTIONS
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
$path = Math::PlanePath::AlternatePaperMidpoint>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.
Level Methods
($n_lo, $n_hi) = $path>level_to_n_range($level)

Return
(0, 2**$level  1)
, or for multiple arms return(0, $arms * (2**$level  1)*$arms)
. This is the same as theDragonMidpoint
.
OEIS
Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include
http://oeis.org/A016116 (etc)
A016116 X/2 at N=2^k, being X/2=2^floor(k/2)
SEE ALSO
Math::PlanePath, Math::PlanePath::AlternatePaper
Math::PlanePath::DragonMidpoint, Math::PlanePath::R5DragonMidpoint, Math::PlanePath::TerdragonMidpoint
HOME PAGE
http://user42.tuxfamily.org/mathplanepath/index.html
LICENSE
Copyright 2012, 2013, 2014, 2015, 2016 Kevin Ryde
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/>.