1Math::PlanePath::AlternUasteerPaCpoenrtMriidbpuotieMndatt(Ph3e:)r:lPlDaonceuPmaetnht:a:tAilotnernatePaperMidpoint(3)
2
3
4

NAME

6       Math::PlanePath::AlternatePaperMidpoint -- alternate paper folding
7       midpoints
8

SYNOPSIS

10        use Math::PlanePath::AlternatePaperMidpoint;
11        my $path = Math::PlanePath::AlternatePaperMidpoint->new;
12        my ($x, $y) = $path->n_to_xy (123);
13

DESCRIPTION

15       This is the midpoints of each alternate paper folding curve
16       (Math::PlanePath::AlternatePaper).
17
18            8  |                        64-65-...
19               |                         |
20            7  |                        63
21               |                         |
22            6  |                  20-21 62
23               |                   |  |  |
24            5  |                  19 22 61-60-59
25               |                   |  |        |
26            4  |            16-17-18 23 56-57-58
27               |             |        |  |
28            3  |            15 26-25-24 55 50-49-48-47
29               |             |  |        |  |        |
30            2  |       4--5 14 27-28-29 54 51 36-37 46
31               |       |  |  |        |  |  |  |  |  |
32            1  |       3  6 13-12-11 30 53-52 35 38 45-44-43
33               |       |  |        |  |        |  |        |
34           Y=0 | 0--1--2  7--8--9-10 31-32-33-34 39-40-41-42
35               +----------------------------------------------
36               X=0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
37
38       The "AlternatePaper" curve begins as follows and the midpoints are
39       numbered from 0,
40
41                             |
42                             9
43                             |
44                        --8--
45                       |     |
46                       7     |
47                       |     |
48                  --2-- --6--
49                 |     |     |
50                 1     3     5
51                 |     |     |
52           *--0--       --4--
53
54       These midpoints are on fractions X=0.5,Y=0, X=1,Y=0.5, etc.  For this
55       "AlternatePaperMidpoint" they're turned 45 degrees and mirrored so the
56       0,1,2 upward diagonal becomes horizontal along the X axis, and the
57       2,3,4 downward diagonal becomes a vertical at X=2, extending to X=2,Y=2
58       at N=4.
59
60       The midpoints are distinct X,Y positions because the alternate paper
61       curve traverses each edge only once.
62
63       The curve is self-similar in 2^level sections due to its unfolding.
64       This can be seen in the midpoints as for example N=0 to N=16 above is
65       the same shape as N=16 to N=32, but the latter rotated +90 degrees and
66       numbered in reverse.
67
68   Arms
69       The midpoints fill an eighth of the plane and eight copies can mesh
70       together perfectly when mirrored and rotated by 90, 180 and 270
71       degrees.  The "arms" parameter can choose 1 to 8 curve arms
72       successively advancing.
73
74       For example "arms => 8" begins as follows.  N=0,8,16,24,etc is the
75       first arm, the same as the plain curve above.  N=1,9,17,25 is the
76       second, N=2,10,18,26 the third, etc.
77
78                             90-82 81-89                       7
79           arms => 8          |  |  |  |
80                            ... 74 73 ...                      6
81                                 |  |
82                                66 65                          5
83                                 |  |
84                    43-35 42-50-58 57-49-41                    4
85                     |  |  |              |
86           91-..    51 27 34-26-18 17-25-33                    3
87            |        |  |        |  |
88           83-75-67-59 19-11--3 10  9 32-40                    2
89                                 |  |  |  |
90           84-76-68-60 20-12--4  2  1 24 48    ..-88           1
91            |        |  |              |  |        |
92           92-..    52 28  5  6  0--8-16 56-64-72-80      <- Y=0
93                     |  |  |  |
94                    44-36 13 14  7-15-23 63-71-79-87          -1
95                           |  |        |  |        |
96                    37-29-21 22-30-38 31 55    ..-95          -2
97                     |              |  |  |
98                    45-53-61 62-54-46 39-47                   -3
99                           |  |
100                          69 70                               -4
101                           |  |
102                      ... 77 78 ...                           -5
103                        |  |  |  |
104                       93-85 86-94                            -6
105
106            ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
107           -7 -6 -5 -4 -3 -2 -1 X=0 1  2  3  4  5  6
108
109       With eight arms like this every X,Y point is visited exactly once,
110       because the 8-arm "AlternatePaper" traverses every edge exactly once
111       ("Arms" in Math::PlanePath::AlternatePaper).
112
113       The arm numbering doesn't correspond to the "AlternatePaper", due to
114       the rotate and reflect of the first arm.  It ends up arms 0 and 1 of
115       the "AlternatePaper" corresponding to arms 7 and 0 of the midpoints
116       here, those two being a pair going horizontally corresponding to a pair
117       in the "AlternatePaper" going diagonally into a quadrant.
118

FUNCTIONS

120       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
121       classes.
122
123       "$path = Math::PlanePath::AlternatePaperMidpoint->new ()"
124           Create and return a new path object.
125
126       "($x,$y) = $path->n_to_xy ($n)"
127           Return the X,Y coordinates of point number $n on the path.  Points
128           begin at 0 and if "$n < 0" then the return is an empty list.
129
130           Fractional positions give an X,Y position along a straight line
131           between the integer positions.
132
133       "$n = $path->n_start()"
134           Return 0, the first N in the path.
135
136   Level Methods
137       "($n_lo, $n_hi) = $path->level_to_n_range($level)"
138           Return "(0, 2**$level - 1)", or for multiple arms return "(0, $arms
139           * (2**$level - 1)*$arms)".  This is the same as the
140           "DragonMidpoint".
141

OEIS

143       Entries in Sloane's Online Encyclopedia of Integer Sequences related to
144       this path include
145
146           <http://oeis.org/A016116> (etc)
147
148           A334576     X coordinate
149           A334577     Y coordinate
150           A016116     X/2 at N=2^k, being X/2=2^floor(k/2)
151

SEE ALSO

153       Math::PlanePath, Math::PlanePath::AlternatePaper
154
155       Math::PlanePath::DragonMidpoint, Math::PlanePath::R5DragonMidpoint,
156       Math::PlanePath::TerdragonMidpoint
157

HOME PAGE

159       <http://user42.tuxfamily.org/math-planepath/index.html>
160

LICENSE

162       Copyright 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin
163       Ryde
164
165       Math-PlanePath is free software; you can redistribute it and/or modify
166       it under the terms of the GNU General Public License as published by
167       the Free Software Foundation; either version 3, or (at your option) any
168       later version.
169
170       Math-PlanePath is distributed in the hope that it will be useful, but
171       WITHOUT ANY WARRANTY; without even the implied warranty of
172       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
173       General Public License for more details.
174
175       You should have received a copy of the GNU General Public License along
176       with Math-PlanePath.  If not, see <http://www.gnu.org/licenses/>.
177
178
179
180perl v5.36.0                      202M3a-t0h1:-:2P0lanePath::AlternatePaperMidpoint(3)
Impressum