NAME

Math::PlanePath::CincoCurve -- 5x5 self-similar curve

SYNOPSIS

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

DESCRIPTION

This is the 5x5 self-similar Cinco curve by John Dennis,

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

        X=0  1   2   3   4   5   6   7   8   9  10  11  12  13  14

The base pattern is the N=0 to N=24 part. It repeats transposed and/or rotated to make the ends join. N=25 to N=49 is a repeat of the base, then N=50 to N=74 is a transpose to go upwards. The sub-part arrangements are as follows.

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

Parts such as 6 going left are the base rotated 180 degrees. The verticals like 2 are a transpose of the base, ie. swap X,Y, and downward vertical like 23 is transpose plus rotate 180 (which is equivalent to a mirror across the anti-diagonal). Notice the base shape fills its sub-part to the left of its edge and the transpose instead fills on the right.

John Dennis conceived this for use in combination with 2x2 Hilbert and 3x3 meander shapes so that sizes which are products of 2, 3 and 5 can be used for partitioning. Such mixed patterns can't be done with the code here, mainly since a mixture depends on having a target top-level size rather than the unlimited size here.

FUNCTIONS

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

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

John Dennis "Inverse Space-Filling Curve Partitioning of a Global Ocean Model"

http://www.cecs.uci.edu/~papers/ipdps07/pdfs/IPDPS-1569010963-paper-2.pdf

And source code from COSIM

http://oceans11.lanl.gov/trac/POP/browser/trunk/pop/source/spacecurve_mod.F90
http://oceans11.lanl.gov/svn/POP/trunk/pop/source/spacecurve_mod.F90