NAME

Math::PlanePath::MathImageQuintetCentres -- self-similar "plus" shape centres

SYNOPSIS

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

DESCRIPTION

This a self-similar curve tracing out a "+" shape like the QuintetCurve but taking the centre of each square visited by that curve.

                                     92                        12
                                   /  |
        124-...                  93  91--90      88            11
          |                        \       \   /   \
    122-123 120     102              94  82  89  86--87        10
       \   /  |    /  |            /   /  |       |
        121 119 103 101-100      95  81  83--84--85             9
               \   \       \       \   \
    114-115-116 118 104  32  99--98  96  80  78                 8
      |       |/   /   /  |       |/      |/   \
112-113 110 117 105  31  33--34  97  36  79  76--77             7
   \   /   \       \   \       \   /   \      |
    111     109-108 106  30  42  35  38--37  75                 6
                  |/   /   /  |       |    /
                107  29  43  41--40--39  74                     5
                       \   \              |
             24--25--26  28  44  46  72--73  70      68         4
              |       |/      |/   \   \   /   \   /   \
         22--23  20  27  18  45  48--47  71  56  69  66--67     3
           \   /   \   /   \      |        /   \      |
             21   6  19  16--17  49  54--55  58--57  65         2
               /   \      |       |    \      |    /
          4-- 5   8-- 7  15      50--51  53  59  64             1
           \      |    /              |/      |    \
      0-- 1   3   9  14              52      60--61  63     <- Y=0
          |/      |    \                          |/
          2      10--11  13                      62            -1
                      |/
                     12                                        -2

      ^
 -1  X=0  1   2   3   4   5   6   7   8   9  10  11  12  13

The base figure is "+" shape of the initial N=0 to N=4,

    .....
    .   .
    . 4 .
    .  \.
........\....
.   |   .\  .
. 0---1 . 3 .
.   | | ./  .
......|./....
    . |/.
    . 2 .
    .   .
    .....

Arms

The optional arms parameter can give up to four copies of the curve, each advancing successively. For example arms=>4 is as follows. Notice the N=4*k points are the plain curve, and N=4*k+1, N=3*k+2 and N=3*k+3 are rotated copies of it.

                     69                     ...              7
                   /  |                        \
    121     113  73  65--61      53             120          6
   /   \   /   \   \       \   /   \           /
...     117 105-109  77  29  57  45--49     116              5
              |    /   /  |       |            \
            101  81  25  33--37--41  96-100-104 112          4
              |    \   \              |       |/
         50  97--93  85  21  13  88--92  80 108  72          3
       /  |       |/      |/   \   \   /   \   /   \
     54  46--42  89  10  17   5-- 9  84  24  76  64--68      2
       \      |    /  |       |        /   \      |
         58  38  14   6-- 2   1  16--20  32--28  60          1
       /      |    \               \      |    /
     62  30--34  22--18   3   0-- 4  12  36  56          <- Y=0
      |    \   /          |       |/      |    \
 70--66  78  26  86  11-- 7  19   8  91  40--44  52         -1
   \   /   \   /   \   \   /  |    /  |       |/
     74 110  82  94--90  15  23  87  95--99  48             -2
       /  |       |            \   \      |
    114 106-102--98  43--39--35  27  83 103                 -3
       \              |       |/   /      |
        118      51--47  59  31  79 111-107 119     ...     -4
       /           \   /   \       \   \   /   \   /
    122              55      63--67  75 115     123         -5
       \                          |/
        ...                      71                         -6

                              ^
 -7  -6  -5  -4  -3  -2  -1  X=0  1   2   3   4   5   6

The pattern an ever expanding "+" shape with first cell N=0 at the origin. The further parts are effectively as follows, though with wiggly spiralling sides. Four parts mesh together and fill the plane.

            +---+
            |   |
    +---+---    +---+
    |   |           |
+---+   +---+   +---+
|         2 | 1 |   |
+---+   +---+---+   +---+
    |   | 3 | 0         |
    +---+   +---+   +---+
    |           |   |
    +---+   +---+---+
        |   |
        +---+

FUNCTIONS

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

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

Fractional positions give an X,Y position along a straight line between the integer positions.

$n = $path->n_start()

Return 0, the first N in the path.

SEE ALSO

Math::PlanePath, Math::PlanePath::Flowsnake