NAME

Math::PlanePath::MathImageAR2W2Curve -- 2x2 self-similar of four pattern parts

SYNOPSIS

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

DESCRIPTION

In progress ...

This is an integer version of the AR2W2 curve by Asano, Ranjan, Roos, Welzl and Widmayer.

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

It makes a 2x2 expanding pattern with a mixture of "U" and "Z" shapes. The mixture is designed to improve some locality measures.

There's four base patterns A to D, plus mirroring,

A1    C1---B2        A2   C2   D1
         \                 | \  |
      D2---B1             B1   B2

B1    C2---B1        B2   B2---C1
       |    |              |    |
      D1   B2             B1   D2

C1    B1---A1        C2   A2---B2
       |    |              |    |
      A2   B2             B1   A1

D1    A2---C2        D2   C1---A1
       |    |              |    |
      D1   A2             A1   D2

The starting pattern is the A1 "Z" shape and above that D2. Notice the starting sub-part of D2 is A1 and in turn the starting sub-part of A1 is D2, so those two alternate at progressively higher levels. The sub-parts of the two then reach all of the others, in transpose and straight forms, forward and reverse, and rotated four directions.

FUNCTIONS

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

$path = Math::PlanePath::MathImageAR2W2Curve->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::HilbertCurve, Math::PlanePath::ZOrderCurve

Asano, Ranjan, Roos, Welzl and Widmayer "Space-Filling Curves and Their Use in the Design of Geometric Data Structures", Theoretical Computer Science, 181(1):3-15, 1997. And LATIN'95 Theoretical Informatics which is at Google Books

http://books.google.com/books?isbn=3540591753