1Math::PlanePath::ImaginUasreyrHaClofn(t3r)ibuted Perl DoMcautmhe:n:tPaltainoenPath::ImaginaryHalf(3)
2
3
4
6 Math::PlanePath::ImaginaryHalf -- half-plane replications in three
7 directions
8
10 use Math::PlanePath::ImaginaryBase;
11 my $path = Math::PlanePath::ImaginaryBase->new (radix => 4);
12 my ($x, $y) = $path->n_to_xy (123);
13
15 This is a half-plane variation on the "ImaginaryBase" path.
16
17 54-55 50-51 62-63 58-59 22-23 18-19 30-31 26-27 3
18 \ \ \ \ \ \ \ \
19 52-53 48-49 60-61 56-57 20-21 16-17 28-29 24-25 2
20
21 38-39 34-35 46-47 42-43 6--7 2--3 14-15 10-11 1
22 \ \ \ \ \ \ \ \
23 36-37 32-33 44-45 40-41 4--5 0--1 12-13 8--9 <- Y=0
24
25 -------------------------------------------------
26 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5
27
28 The pattern can be seen by dividing into blocks,
29
30 +---------------------------------+
31 | 22 23 18 19 30 31 26 27 |
32 | |
33 | 20 21 16 17 28 29 24 25 |
34 +--------+-------+----------------+
35 | 6 7 | 2 3 | 14 15 10 11 |
36 | +---+---+ |
37 | 4 5 | 0 | 1 | 12 13 8 9 | <- Y=0
38 +--------+---+---+----------------+
39 ^
40 X=0
41
42 N=0 is at the origin, then N=1 replicates it to the right. Those two
43 repeat above as N=2 and N=3. Then that 2x2 repeats to the left as N=4
44 to N=7, then 4x2 repeats to the right as N=8 to N=15, and 8x2 above as
45 N=16 to N=31, etc. The replications are successively to the right,
46 above, left. The relative layout within a replication is unchanged.
47
48 This is similar to the "ImaginaryBase", but where it repeats in 4
49 directions there's just 3 directions here. The "ZOrderCurve" is a 2
50 direction replication.
51
52 Radix
53 The "radix" parameter controls the radix used to break N into X,Y. For
54 example "radix => 4" gives 4x4 blocks, with radix-1 replications of the
55 preceding level at each stage.
56
57 radix => 4
58
59 60 61 62 63 44 45 46 47 28 29 30 31 12 13 14 15 3
60 56 57 58 59 40 41 42 43 24 25 26 27 8 9 10 11 2
61 52 53 54 55 36 37 38 39 20 21 22 23 4 5 6 7 1
62 48 49 50 51 32 33 34 35 16 17 18 19 0 1 2 3 <- Y=0
63
64 --------------------------------------^-----------
65 -12-11-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3
66
67 Notice for X negative the parts replicate successively towards
68 -infinity, so the block N=16 to N=31 is first at X=-4, then N=32 at
69 X=-8, N=48 at X=-12, and N=64 at X=-16 (not shown).
70
71 Digit Order
72 The "digit_order" parameter controls the order digits from N are
73 applied to X and Y. The default above is "XYX" so the replications go
74 X then Y then negative X.
75
76 "XXY" goes to negative X before Y, so N=2,N=3 goes to negative X before
77 repeating N=4 to N=7 in the Y direction.
78
79 digit_order => "XXY"
80
81 38 39 36 37 46 47 44 45
82 34 35 32 33 42 43 40 41
83 6 7 4 5 14 15 12 13
84 2 3 0 1 10 11 8 9
85 ---------^--------------------
86 -2 -1 X=0 1 2 3 4 5
87
88 The further options are as follows, for six permutations of each 3
89 digits from N.
90
91 digit_order => "YXX" digit_order => "XnYX"
92 38 39 36 37 46 47 44 45 19 23 18 22 51 55 50 54
93 34 35 32 33 42 43 40 41 17 21 16 20 49 53 48 52
94 6 7 4 5 14 15 12 13 3 7 2 6 35 39 34 38
95 2 3 0 1 10 11 8 9 1 5 0 4 33 37 32 36
96
97 digit_order => "XnXY" digit_order => "YXnX"
98 37 39 36 38 53 55 52 54 11 15 9 13 43 47 41 45
99 33 35 32 34 49 51 48 50 10 14 8 12 42 46 40 44
100 5 7 4 6 21 23 20 22 3 7 1 5 35 39 33 37
101 1 3 0 2 17 19 16 18 2 6 0 4 34 38 32 36
102
103 "Xn" means the X negative direction. It's still spaced 2 apart (or
104 whatever radix), so the result is not simply a -X,Y.
105
106 Axis Values
107 N=0,1,4,5,8,9,etc on the X axis (positive and negative) are those
108 integers with a 0 at every third bit starting from the second least
109 significant bit. This is simply demanding that the bits going to the Y
110 coordinate must be 0.
111
112 X axis Ns = binary ...__0__0__0_ with _ either 0 or 1
113 in octal, digits 0,1,4,5 only
114
115 N=0,1,8,9,etc on the X positive axis have the highest 1-bit in the
116 first slot of a 3-bit group. Or N=0,4,5,etc on the X negative axis
117 have the high 1 bit in the third slot,
118
119 X pos Ns = binary 1_0__0__0...0__0__0_
120 X neg Ns = binary 10__0__0__0...0__0__0_
121 ^^^
122 three bit group
123
124 X pos Ns in octal have high octal digit 1
125 X neg Ns in octal high octal digit 4 or 5
126
127 N=0,2,16,18,etc on the Y axis are conversely those integers with a 0 in
128 two of each three bits, demanding the bits going to the X coordinate
129 must be 0.
130
131 Y axis Ns = binary ..._00_00_00_0 with _ either 0 or 1
132 in octal has digits 0,2 only
133
134 For a radix other than binary the pattern is the same. Each "_" is any
135 digit of the given radix, and each 0 must be 0. The high 1 bit for X
136 positive and negative become a high non-zero digit.
137
138 Level Ranges
139 Because the X direction replicates twice for each once in the Y
140 direction the width grows at twice the rate, so after each 3
141 replications
142
143 width = height*height
144
145 For this reason N values for a given Y grow quite rapidly.
146
147 Proth Numbers
148 The Proth numbers, k*2^n+1 for k<2^n, fall in columns on the path.
149
150 * * *
151
152
153
154 * * *
155
156
157
158 * * *
159
160
161
162 * * * * *
163
164
165
166 * * * * *
167
168 * * * *
169
170 * * * * * * * * *
171
172 * * * * * *
173 *
174 * * * * * * * * * * * *
175
176 -----------------------------------------------------------------
177 -31 -23 -15 -7 -3-1 0 3 5 9 17 25 33
178
179 The height of the column is from the zeros in X ending binary
180 ...1000..0001 since this limits the "k" part of the Proth numbers which
181 can have N ending suitably. Or for X negative ending ...10111...11.
182
184 See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
185 classes.
186
187 "$path = Math::PlanePath::ImaginaryBase->new ()"
188 "$path = Math::PlanePath::ImaginaryBase->new (radix => $r, digit_order
189 => $str)"
190 Create and return a new path object. The choices for "digit_order"
191 are
192
193 "XYX"
194 "XXY"
195 "YXX"
196 "XnYX"
197 "XnXY"
198 "YXnX"
199
200 "($x,$y) = $path->n_to_xy ($n)"
201 Return the X,Y coordinates of point number $n on the path. Points
202 begin at 0 and if "$n < 0" then the return is an empty list.
203
204 "($n_lo, $n_hi) = $path->rect_to_n_range ($x1,$y1, $x2,$y2)"
205 The returned range is exact, meaning $n_lo and $n_hi are the
206 smallest and biggest in the rectangle.
207
208 Level Methods
209 "($n_lo, $n_hi) = $path->level_to_n_range($level)"
210 Return "(0, $radix**$level - 1)".
211
213 Math::PlanePath, Math::PlanePath::ImaginaryBase,
214 Math::PlanePath::ZOrderCurve
215
217 <http://user42.tuxfamily.org/math-planepath/index.html>
218
220 Copyright 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
221
222 This file is part of Math-PlanePath.
223
224 Math-PlanePath is free software; you can redistribute it and/or modify
225 it under the terms of the GNU General Public License as published by
226 the Free Software Foundation; either version 3, or (at your option) any
227 later version.
228
229 Math-PlanePath is distributed in the hope that it will be useful, but
230 WITHOUT ANY WARRANTY; without even the implied warranty of
231 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
232 General Public License for more details.
233
234 You should have received a copy of the GNU General Public License along
235 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
236
237
238
239perl v5.32.0 2020-07-28 Math::PlanePath::ImaginaryHalf(3)