NAME

Math::PlanePath::PeanoRounded -- 3x3 self-similar quadrant traversal, with rounded corners

SYNOPSIS

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

# or another radix digits ...
my $path5 = Math::PlanePath::PeanoRounded->new (radix => 5);

DESCRIPTION

This is a version of the PeanoCurve with rounded-off corners,

11  |                      76-75       72-71       68-67
    |                     /     \     /     \     /     \
10  |                   77       74-73       70-69       66
    |                    |                                |
 9  |                   78       81-82       61-62       65
    |                     \     /     \     /     \     /
 8  |                      79-80       83 60       63-64
    |                                   |  |
 7  |                      88-87       84 59       56-55
    |                     /     \     /     \     /     \
 6  |               ...-89       86-85       58-57       54
    |                                                     |
 5  |    13-14       17-18       21-22       49-50       53
    |   /     \     /     \     /     \     /     \     /
 4  | 12       15-16       19-20       23 48       51-52
    |  |                                |  |
 3  | 11        8--7       28-27       24 47       44-43
    |   \     /     \     /     \     /     \     /     \
 2  |    10--9        6 29       26-25       46-45       42
    |                 |  |                                |
 1  |     1--2        5 30       33-34       37-38       41
    |   /     \     /     \     /     \     /     \     /
Y=0 |  0        3--4       31-32       35-36       39-40
    +------------------------------------------------------
     X=0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17

Radix

The radix parameter can do the calculation in a base other than 3, using the same kind of direction reversals. For example radix 5 gives 5x5 groups,

 9  |     41-42       45-46       49-...
    |    /     \     /     \     /
 8  |  40       43-44       47-48
    |   |                                radix=5
 7  |  39       36-35       32-31
    |    \     /     \     /     \
 6  |     38-37       34-33       30
    |                              |
 5  |     21-22       25-26       29
    |    /     \     /     \     /
 4  |  20       23-24       27-28
    |   |
 3  |  19       16-15       12-11
    |    \     /     \     /     \
 2  |     18-17       14-13       10
    |                              |
 1  |      1--2        5--6        9
    |    /     \     /     \     /
Y=0 |   0        3--4        7--8
    |
    +---------------------------------
      X=0  1  2  3  4  5  6  7  8  9

If the radix is even then the ends of each group don't join up. For example in radix 4 N=31 isn't next to N=32.

 7  |     30-29       26-25    32
    |    /     \     /     \     \
 6  |  31       28-27       24    33--...
    |                        |
 5  |     17-18       21-22  |
    |    /     \     /     \ |
 4  |  16       19-20       23
    |  |
 3  |  |  14-13       10--9
    |  | /     \     /     \
 2  |  15       12-11        8
    |                        |
 1  |      1--2        5--6  |
    |    /     \     /     \ |
Y=0 |   0        3--4        7
    +-----------------------------------------
      X=0  1  2  4  5  6  7  8  9 10

FUNCTIONS

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

$path = Math::PlanePath::PeanoRounded->new ()
$path = Math::PlanePath::PeanoRounded->new (radix => $r)

Create and return a new path object.

The optional radix parameter gives the base for digit splitting. The default is ternary, radix => 3.

($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.

SEE ALSO

Math::PlanePath, Math::PlanePath::PeanoCurve, Math::PlanePath::DragonRounded

Guiseppe Peano, "Sur une courbe, qui remplit toute une aire plane", Mathematische Annalen, volume 36, number 1, 1890, p157-160

http://www.springerlink.com/content/w232301n53960133/
DOI 10.1007/BF01199438

HOME PAGE

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

LICENSE

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