NAME

Math::PlanePath::MathImageWunderlichCurve -- 3x3 self-similar quadrant traversal

SYNOPSIS

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

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

DESCRIPTION

In progress.

This path is an integer version of ...

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

     X=0   1   2   3   4   5   6   7   8   9 ...

FUNCTIONS

$path = Math::PlanePath::MathImageWunderlichCurve->new ()
$path = Math::PlanePath::MathImageWunderlichCurve->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. The radix should be an odd number, 3, 5, 7, 9 etc.

($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. Integer positions are always just 1 apart either horizontally or vertically, so the effect is that the fraction part appears either added to or subtracted from X or Y.

$n = $path->xy_to_n ($x,$y)

Return an integer point number for coordinates $x,$y. Each integer N is considered the centre of a unit square and an $x,$y within that square returns N.

($n_lo, $n_hi) = $path->rect_to_n_range ($x1,$y1, $x2,$y2)

Return a range of N values which occur in a rectangle with corners at $x1,$y1 and $x2,$y2. If the X,Y values are not integers then the curve is treated as unit squares centred on each integer point and squares which are partly covered by the given rectangle are included.

SEE ALSO

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