The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::PlanePath::DekkingCurve -- 5x5 self-similar edge curve

SYNOPSIS

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

DESCRIPTION

This is an integer version of a 5x5 self-similar curve by Dekking,

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

The base pattern is the N=0 to N=25 section. It then repeats with rotations or reversals which make the ends join. For example N=75 to N=100 is the base pattern in reverse, ie. from N=25 down to N=0. Or N=50 to N=75 is reverse and also rotate by -90.

The curve segments are edges of squares in a 5x5 arrangement.

     +- - -+- - -+- - 14----15  ---+
     |     |     |     |  v  |>    |
        ^     ^       <|     |      
    10----11----12----13- - 16   --+
     |              v        |>    |
     |>       ^           ^  |      
     9-----8-----7 -- 18----17   --+
        v  |     |     |>          |
     |        ^  |>    |        ^   
     +- -  5-----6 -  19    22----23
           |          <|     |    <|
     |    <|  ^        |    <|     |
     +- -  4-----3    20----21 -- 24
                 |       v        <|
        ^     ^  |>    |     |     |
     0-----1-----2  -- + -- -+-   25

The little notch marks show which square each edge represents. This is the side the curve expands into at the next level. For example N=1 to N=2 has its notch on the left so the next level N=25 to N=50 expands on the left.

An expansion on the left is a repeat of the base shape, possibly rotated 90, 180 or 270 degrees. An expansion on the right is the base shape in reverse, as for example N=2 to N=3 on the right becomes N=50 to N=75 traversing to the right at the next level.

FUNCTIONS

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

$path = Math::PlanePath::DekkingCurve->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::DekkingCentres, Math::PlanePath::CincoCurve, Math::PlanePath::PeanoCurve

HOME PAGE

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

LICENSE

Copyright 2011, 2012, 2013 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/>.