NAME

Math::PlanePath::LTiling -- 2x2 self-similar of four pattern parts

SYNOPSIS

use Math::PlanePath::LTiling;
my $path = Math::PlanePath::LTiling->new;
my ($x, $y) = $path->n_to_xy (123);

DESCRIPTION

This is a self-similar tiling by "L" shapes where a base L is replicated four times with the ends turned +90 and -90 degrees to make a larger L,

                          +-----+-----+
                          |12   |   15|
                          |  +--+--+  |
                          |  |14   |  |
                          +--+  +--+--+
                          |  |  |11   |
                          |  +--+  +--+
                          |13   |  |  |
+-----+                   +-----+--+  +--+--+-----+
| 3   |                   | 3   |  |10   |  |    5|
|  +--+          -->      |  +--+  +--+--+  +--+  |
|  |  |                   |  |  | 8   |   9 |  |  |
+--+  +--+--+             +--+  +--+--+--+--+  +--+
|  | 2   |  |             |  | 2   |  |  |   6 |  |
|  +--+--+  |             |  +--+--+  |  +--+--+  |
| 0   |   1 |             | 0   |   1 | 7   |   4 |
+-----+-----+             +-----+-----+-----+-----+

The parts are numbered to the left then middle then upper, and this relative layout is maintained when turned for the end parts in the next replication level.

The result is to visit 1 of every 3 points in the first quadrant with a subtle layout of the points and spaces making diagonal lines and little 2x2 blocks.

15  |  48          51  61          60 140         143 163
14  |      50                  62         142                 168
13  |          56          59                 139         162
12  |  49          58              63 141             160
11  |  55              44          47 131         138
10  |          57          46                 136         137
 9  |      54                  43         130                 134
 8  |  52          53  45             128         129 135
 7  |  12          15  35          42              37  21
 6  |      14                  40          41                  22
 5  |          11          34                  38          25
 4  |  13              32          33  39          36
 3  |   3          10               5  31              26
 2  |           8           9                  27          24
 1  |       2                   6          30                  18
Y=0 |   0           1   7           4  28          29  19
    +------------------------------------------------------------
       X=0  1   2   3   4   5   6   7   8   9  10  11  12  13  14

The N values 0,2,8,10,32,etc on the X=Y leading diagonal are all the integers made from only digits 0 and 2 in base 4. Or equivalently all integers which have zero bits at all even numbered positions (and either 0 or 1 at odd positions).

Ends

Option L_fill => "all" numbers the endpoints within each "L", the left then upper. This is the inverse of the default middle shown above and visits all the points the middle option doesn't, and on that basis 2 of every 3 points in the first quadrant.

 15  |      97 102         123 120         281 286         327 337
 14  |  96     101 103 122 124     121 280     285 287 326 325
 13  |  99 100     113 118     125 126 283 284     279 321     324
 12  |      98 112     117 119 127         282 278 277     320 323
 11  |     111 115 116      89  94         263 273     276 274 266
 10  | 110 109     114  88      93  95 262 261     272 275     268
  9  | 105     108 106  91  92      87 257     260 258 271 269
  8  |     104 107          90  86  85     256 259         270 265
  7  |      25  30          71  81      84  82  74          43  40
  6  |  24      29  31  70  69      80  83      76  75  42  44
  5  |  27  28      23  65      68  66  79  77      72  50      45
  4  |      26  22  21      64  67          78  73      52  51  47
  3  |       7  17      20  18  10          63  55  53      48  34
  2  |   6   5      16  19      12  11  62  61      54  49      36
  1  |   1       4   2  15  13       8  57      60  58  39  37
 Y=0 |       0   3          14   9          56  59          38  33
     +------------------------------------------------------------
        X=0  1   2   3   4   5   6   7   8   9  10  11  12  13  14

+-----+
|    7|
|  +--+
| 6| 5|
+--+  +--+--+
| 1|    4| 2|
|  +--+--+  |
|    0| 3   |
+-----+-----+

All

Option L_fill => "all" numbers all three points of each "L", as middle, left then right. With this the path visits all points of the first quadrant.

 7  |  36  38  46  45 105 107 122 126
 6  |  37  42  44  47 106 104 120 121
 5  |  41  43  33  35  98 102 103 100
 4  |  39  40  34  32  96  97 101  99
 3  |   9  11  26  30  31  28  16  15
 2  |  10   8  24  25  29  27  19  17
 1  |   2   6   7   4  23  20  18  13
Y=0 |   0   1   5   3  21  22  14  12
    +---------------------------------
       X=0  1   2   3   4   5   6   7

+-----+
| 9 11|
|  +--+
|10| 8|
+--+  +--+--+
| 2| 6  7| 4|
|  +--+--+  |
| 0  1| 5  3|
+-----+-----+

Level Ranges

For the default "middles" numbering, and taking the initial N=0 tile as level 0, a replication level is

Nstart = 0
Nlevel = 4^level - 1      inclusive

Xmax = Ymax = 2 * 2^level - 1

For example level 2 which is the right hand tiling shown above is N=0 to N=4^2-1=15 and extends to Xmax=Ymax=2*2^2-1=7.

For the "ends" variation there's two per tile, or for "all" there's three, in which case the Nlevel becomes

Nlevel_ends = 2 * 4^level - 1
Nlevel_all  = 3 * 4^level - 1

FUNCTIONS

See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes.

$path = Math::PlanePath::LTiling->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.

SEE ALSO

Math::PlanePath, Math::PlanePath::CornerReplicate, Math::PlanePath::SquareReplicate, Math::PlanePath::QuintetReplicate, Math::PlanePath::GosperReplicate

HOME PAGE

http://user42.tuxfamily.org/math-planepath/index.html

LICENSE

Copyright 2011 Kevin Ryde

This file is part of Math-PlanePath.

Math-PlanePath 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.

Math-PlanePath 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 Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.