and 1 contributors

# NAME

Math::PlanePath::QuintetReplicate -- self-similar "+" tiling

# SYNOPSIS

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

# DESCRIPTION

This is a self-similar tiling of the plane with "+" shapes. It's the same kind of tiling as the `QuintetCurve` (and `QuintetCentres`), but with the middle square of the "+" shape centred on the origin.

``````            12                         3

13  10  11       7             2

14   2   8   5   6         1

17   3   0   1   9         <- Y=0

18  15  16   4  22                -1

19      23  20  21            -2

24                -3

^
-4 -3 -2 -1 X=0  1  2  3  4``````

The base pattern is a "+" shape

``````        +---+
| 2 |
+---+---+---+
| 3 | 0 | 1 |
+---+---+---+
| 4 |
+---+``````

which is then replicated

``````         +--+
|  |
+--+  +--+  +--+
|   10   |  |  |
+--+  +--+--+  +--+
|  |  |   5    |
+--+--+  +--+  +--+
|  |   0    |  |
+--+  +--+  +--+--+
|   15   |  |  |
+--+  +--+--+  +--+
|  |  |   20   |
+--+  +--+  +--+
|  |
+--+``````

The effect is to tile the whole plane. Notice the centres 0,5,10,15,20 are the same "+" shape but rotated around by an angle atan(1/2)=26.565 degrees, as noted below.

## Complex Base

This tiling corresponds to expressing a complex integer X+i*Y in base b=2+i

``    X+Yi = a[n]*b^n + ... + a*b^2 + a*b + a``

where each digit a[i] is

``````    a[i] digit     N digit
----------     -------
0             0
1             1
i             2
-1             3
-i             4``````

The base b=2+i is at an angle atan(1/2) = 26.56 degrees as seen at N=5 above. Successive powers b^2, b^3, b^4 etc at N=5^level rotate around by that much each time.

``````    Npow = 5^level
angle = level*26.56 degrees

# FUNCTIONS

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

`\$path = Math::PlanePath::QuintetReplicate->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.

## Level Methods

`(\$n_lo, \$n_hi) = \$path->level_to_n_range(\$level)`

Return `(0, 5**\$level - 1)`.