1Math::PlanePath::LTilinUgs(e3r)Contributed Perl DocumentMaattiho:n:PlanePath::LTiling(3)
2
3
4
6 Math::PlanePath::LTiling -- 2x2 self-similar of four pattern parts
7
9 use Math::PlanePath::LTiling;
10 my $path = Math::PlanePath::LTiling->new;
11 my ($x, $y) = $path->n_to_xy (123);
12
14 This is a self-similar tiling by "L" shapes. A base "L" is replicated
15 four times with end parts turned +90 and -90 degrees to make a larger
16 L,
17
18 +-----+-----+
19 |12 | 15|
20 | +--+--+ |
21 | |14 | |
22 +--+ +--+--+
23 | | |11 |
24 | +--+ +--+
25 |13 | | |
26 +-----+ +-----+--+ +--+--+-----+
27 | 3 | | 3 | |10 | | 5|
28 | +--+ --> | +--+ +--+--+ +--+ |
29 | | | | | | 8 | 9 | | |
30 +--+ +--+ +--+--+ +--+ +--+--+--+--+ +--+
31 | | --> | | 2 | | | | 2 | | | 6 | |
32 | +--+ | +--+--+ | | +--+--+ | +--+--+ |
33 | 0 | | 0 | 1 | | 0 | 1 | 7 | 4 |
34 +-----+ +-----+-----+ +-----+-----+-----+-----+
35
36 The parts are numbered to the left then middle then upper. This
37 relative numbering is maintained when rotated at the next replication
38 level, as for example N=4 to N=7.
39
40 The result is to visit 1 of every 3 points in the first quadrant with a
41 subtle layout of points and spaces making diagonal lines and little 2x2
42 blocks.
43
44 15 | 48 51 61 60 140 143 163
45 14 | 50 62 142 168
46 13 | 56 59 139 162
47 12 | 49 58 63 141 160
48 11 | 55 44 47 131 138
49 10 | 57 46 136 137
50 9 | 54 43 130 134
51 8 | 52 53 45 128 129 135
52 7 | 12 15 35 42 37 21
53 6 | 14 40 41 22
54 5 | 11 34 38 25
55 4 | 13 32 33 39 36
56 3 | 3 10 5 31 26
57 2 | 8 9 27 24
58 1 | 2 6 30 18
59 Y=0 | 0 1 7 4 28 29 19
60 +------------------------------------------------------------
61 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
62
63 On the X=Y leading diagonal N=0,2,8,10,32,etc is the integers made from
64 only digits 0 and 2 in base 4. Or equivalently integers which have
65 zero bits at all even numbered positions, binary c0d0e0f0.
66
67 Left or Upper
68 Option "L_fill => "left"" or "L_fill => "upper"" numbers the tiles
69 instead at their left end or upper end respectively.
70
71 L_fill => 'left' 8 | 52 45 43
72 7 | 15 42
73 +-----+ 6 | 12 35 40
74 | | 5 | 14 34 33
75 | +--+ 4 | 13 11 32
76 | 3| | 3 | 10 9 5
77 +--+ +--+--+ 2 | 3 8 6 31
78 | | 2| 1| 1 | 2 1 4
79 | +--+--+ | Y=0 | 0 7
80 | 0| | +------------------------------------
81 +-----+-----+ X=0 1 2 3 4 5 6 7 8
82
83
84 L_fill => 'upper' 8 | 53 42
85 7 | 12 35 40
86 +-----+ 6 | 14 15 34 41
87 | 3| 5 | 13 11 32 39
88 | +--+ 4 | 10 33
89 | | 2| 3 | 3 8
90 +--+ +--+--+ 2 | 2 9 5
91 | 0| | | 1 | 0 7 6 28
92 | +--+--+ | Y=0 | 1 4
93 | | 1 | +------------------------------------
94 +-----+-----+ X=0 1 2 3 4 5 6 7 8
95
96 The effect is to disrupt the pattern a bit though the overall structure
97 of the replications is unchanged.
98
99 "left" is as viewed looking towards the L from above. It may have been
100 better to call it "right", but won't change that now.
101
102 Ends
103 Option "L_fill => "ends"" numbers the two endpoints within each "L",
104 first the left then upper. This is the inverse of the default middle
105 shown above, ie. it visits all the points which the middle option
106 doesn't, and so 2 of every 3 points in the first quadrant.
107
108 +-----+
109 | 7|
110 | +--+
111 | 6| 5|
112 +--+ +--+--+
113 | 1| 4| 2|
114 | +--+--+ |
115 | 0| 3 |
116 +-----+-----+
117
118 15 | 97 102 123 120 281 286 327 337
119 14 | 96 101 103 122 124 121 280 285 287 326 325
120 13 | 99 100 113 118 125 126 283 284 279 321 324
121 12 | 98 112 117 119 127 282 278 277 320 323
122 11 | 111 115 116 89 94 263 273 276 274 266
123 10 | 110 109 114 88 93 95 262 261 272 275 268
124 9 | 105 108 106 91 92 87 257 260 258 271 269
125 8 | 104 107 90 86 85 256 259 270 265
126 7 | 25 30 71 81 84 82 74 43 40
127 6 | 24 29 31 70 69 80 83 76 75 42 44
128 5 | 27 28 23 65 68 66 79 77 72 50 45
129 4 | 26 22 21 64 67 78 73 52 51 47
130 3 | 7 17 20 18 10 63 55 53 48 34
131 2 | 6 5 16 19 12 11 62 61 54 49 36
132 1 | 1 4 2 15 13 8 57 60 58 39 37
133 Y=0 | 0 3 14 9 56 59 38 33
134 +------------------------------------------------------------
135 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
136
137 All
138 Option "L_fill => "all"" numbers all three points of each "L", as
139 middle, left then right. With this the path visits all points of the
140 first quadrant.
141
142 7 | 36 38 46 45 105 107 122 126
143 +-----+ 6 | 37 42 44 47 106 104 120 121
144 | 9 11| 5 | 41 43 33 35 98 102 103 100
145 | +--+ 4 | 39 40 34 32 96 97 101 99
146 |10| 8| 3 | 9 11 26 30 31 28 16 15
147 +--+ +--+--+ 2 | 10 8 24 25 29 27 19 17
148 | 2| 6 7| 4| 1 | 2 6 7 4 23 20 18 13
149 | +--+--+ | Y=0 | 0 1 5 3 21 22 14 12
150 | 0 1| 5 3| +--------------------------------
151 +-----+-----+ X=0 1 2 3 4 5 6 7
152
153 Along the X=Y leading diagonal N=0,6,24,30,96,etc are triples of the
154 values from the single-point case, so 3* numbers using digits 0 and 2
155 in base 4, which is the same as 2* numbers using 0 and 3 in base 4.
156
157 Level Ranges
158 For the "middles", "left" or "upper" cases with one N per tile, and
159 taking the initial N=0 tile as level 0, a replication level is
160
161 Nstart = 0
162 to
163 Nlevel = 4^level - 1 inclusive
164
165 Xmax = Ymax = 2 * 2^level - 1
166
167 For example level 2 which is the large tiling shown in the introduction
168 is N=0 to N=4^2-1=15 and extends to Xmax=Ymax=2*2^2-1=7.
169
170 For the "ends" variation there's two points per tile, or for "all"
171 there's three, in which case the Nlevel increases to
172
173 Nlevel_ends = 2 * 4^level - 1
174 Nlevel_all = 3 * 4^level - 1
175
177 See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
178 classes.
179
180 "$path = Math::PlanePath::LTiling->new ()"
181 "$path = Math::PlanePath::LTiling->new (L_fill => $str)"
182 Create and return a new path object. The "L_fill" choices are
183
184 "middle" the default
185 "left"
186 "upper"
187 "ends"
188 "all"
189
190 "($x,$y) = $path->n_to_xy ($n)"
191 Return the X,Y coordinates of point number $n on the path. Points
192 begin at 0 and if "$n < 0" then the return is an empty list.
193
194 Level Methods
195 "($n_lo, $n_hi) = $path->level_to_n_range($level)"
196 Return
197
198 0, 4**$level - 1 middle, left, upper
199 0, 2*4**$level - 1 ends
200 0, 3*4**$level - 1 all
201
202 There are 4^level L shapes in a level, each containing 1, 2 or 3
203 points, numbered starting from 0.
204
206 Entries in Sloane's Online Encyclopedia of Integer Sequences related to
207 this path include
208
209 <http://oeis.org/A062880> (etc)
210
211 L_fill=middle
212 A062880 N on X=Y diagonal, base 4 digits 0,2 only
213 A048647 permutation N at transpose Y,X
214 base4 digits 1<->3 and 0,2 unchanged
215 A112539 X+Y+1 mod 2, parity inverted
216
217 L_fill=left or upper
218 A112539 X+Y mod 2, parity
219
220 A112539 is a parity of bits at even positions in N, ie. count 1-bits at
221 even bit positions (least significant is bit position 0), then add 1
222 and take mod 2. This works because in the pattern sub-blocks 0 and 2
223 are unchanged and 1 and 3 are turned so as to be on opposite X,Y
224 odd/even parity, so a flip for every even position 1-bit.
225 L_fill=middle starts on a 0 even parity, and L_fill=left and upper
226 start on 1 odd parity. The latter is the form in A112539 and
227 L_fill=middle is the bitwise 0<->1 inverse.
228
230 Math::PlanePath, Math::PlanePath::CornerReplicate,
231 Math::PlanePath::SquareReplicate, Math::PlanePath::QuintetReplicate,
232 Math::PlanePath::GosperReplicate
233
235 <http://user42.tuxfamily.org/math-planepath/index.html>
236
238 Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
239
240 This file is part of Math-PlanePath.
241
242 Math-PlanePath is free software; you can redistribute it and/or modify
243 it under the terms of the GNU General Public License as published by
244 the Free Software Foundation; either version 3, or (at your option) any
245 later version.
246
247 Math-PlanePath is distributed in the hope that it will be useful, but
248 WITHOUT ANY WARRANTY; without even the implied warranty of
249 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
250 General Public License for more details.
251
252 You should have received a copy of the GNU General Public License along
253 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
254
255
256
257perl v5.32.0 2020-07-28 Math::PlanePath::LTiling(3)