NAME

Math::PlanePath::MathImageSquareflakeSide -- zig-zag of eight segments

SYNOPSIS

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

DESCRIPTION

This path is a self-similar zig-zag of eight segments,

                              45-46                         5
                               |  |
                        40-41 44 47-48                      4
                         |  |  |     |
                     38-39 42-43 50-49                      3
                      |           |
                     37-36-35    51-52-53                   2
                            |           |
       5--6             33-34       55-54 61-62             1
       |  |              |           |     |  |
 0--1  4  7--8          32          56-57 60 63-64      <- Y=0
    |  |     |           |              |  |     |
    2--3 10--9       30-31             58-59    ...        -1
          |           |
         11-12-13    29-28-27                              -2
                |           |
            15-14 21-22 25-26                              -3
             |     |  |  |
            16-17 20 23-24                                 -4
                |  |
               18-19                                       -5
 ^
X=0 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16

The base shape is the initial N=0 to N=8 section,

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

It then repeats, with sections turned to follow the edges, so N=8 to N=16 is the same shape going downwards, then N=16 to N=24 across, N=24 to N=32 upwards, etc.

The result is the base figure at ever greater scale, extending to the right, and with wiggly lines making up the segments. The wiggles don't overlap.

A given replication extends to

Nlevel = 8^level
X = 4^level
Y = 0

Ymax = 4^0 + 4^1 + ... + 4^level   # 11...11 in base 4
     = (4^(level+1) - 1) / 3
Ymin = - Ymax

FUNCTIONS

$path = Math::PlanePath::MathImageSquareflakeSide->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::KochCurve

Math::Fractal::Curve -- its examples/generator4.pl is this curve