.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Math::PlanePath::PeanoCurve 3pm" .TH Math::PlanePath::PeanoCurve 3pm "2014-08-26" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::PeanoCurve \-\- 3x3 self\-similar quadrant traversal .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::PeanoCurve; \& my $path = Math::PlanePath::PeanoCurve\->new; \& my ($x, $y) = $path\->n_to_xy (123); \& \& # or another radix digits ... \& my $path5 = Math::PlanePath::PeanoCurve\->new (radix => 5); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This path is an integer version of the curve described by Peano for filling a unit square, .IX Xref "Peano, Guiseppe" .Sp .RS 4 Guiseppe Peano, \*(L"Sur une courbe, qui remplit toute une aire plane\*(R", Mathematische Annalen, volume 36, number 1, 1890, p157\-160. \s-1DOI 10.1007/BF01199438. \&\s0 .RE .PP It traverses a quadrant of the plane one step at a time in a self-similar 3x3 pattern, .PP .Vb 10 \& 8 60\-\-61\-\-62\-\-63\-\-64\-\-65 78\-\-79\-\-80\-\-... \& | | | \& 7 59\-\-58\-\-57 68\-\-67\-\-66 77\-\-76\-\-75 \& | | | \& 6 54\-\-55\-\-56 69\-\-70\-\-71\-\-72\-\-73\-\-74 \& | \& 5 53\-\-52\-\-51 38\-\-37\-\-36\-\-35\-\-34\-\-33 \& | | | \& 4 48\-\-49\-\-50 39\-\-40\-\-41 30\-\-31\-\-32 \& | | | \& 3 47\-\-46\-\-45\-\-44\-\-43\-\-42 29\-\-28\-\-27 \& | \& 2 6\-\-\-7\-\-\-8\-\-\-9\-\-10\-\-11 24\-\-25\-\-26 \& | | | \& 1 5\-\-\-4\-\-\-3 14\-\-13\-\-12 23\-\-22\-\-21 \& | | | \& Y=0 0\-\-\-1\-\-\-2 15\-\-16\-\-17\-\-18\-\-19\-\-20 \& \& X=0 1 2 3 4 5 6 7 8 9 ... .Ve .PP The start is an S shape of the nine points 0 to 8, and then nine of those groups are put together in the same S configuration. The sub-parts are flipped horizontally and/or vertically to make the starts and ends adjacent, so 8 is next to 9, 17 next to 18, etc, .PP .Vb 10 \& 60,61,62 \-\-\- 63,64,65 78,79,80 \& 59,58,57 68,67,55 77,76,75 \& 54,55,56 69,70,71 \-\-\- 72,73,74 \& | \& | \& 53,52,51 38,37,36 \-\-\- 35,34,33 \& 48,49,50 39,40,41 30,31,32 \& 47,46,45 \-\-\- 44,43,42 29,28,27 \& | \& | \& 6,7,8 \-\-\-\- 9,10,11 24,25,26 \& 3,4,5 12,13,14 23,22,21 \& 0,1,2 15,16,17 \-\-\- 18,19,20 .Ve .PP The process repeats, tripling in size each time. .PP Within a power\-of\-3 square, 3x3, 9x9, 27x27, 81x81 etc (3^k)x(3^k) at the origin, all the N values 0 to 3^(2*k)\-1 are within the square. The top right corner 8, 80, 728, etc is the 3^(2*k)\-1 maximum in each. .PP Because each step is by 1, the distance along the curve between two X,Y points is the difference in their N values as given by \f(CW\*(C`xy_to_n()\*(C'\fR. .SS "Radix" .IX Subsection "Radix" The \f(CW\*(C`radix\*(C'\fR 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, .PP .Vb 1 \& radix => 5 \& \& 4 | 20\-\-21\-\-22\-\-23\-\-24\-\-25\-\-26\-\-27\-\-28\-\-29 \& | | | \& 3 | 19\-\-18\-\-17\-\-16\-\-15 34\-\-33\-\-32\-\-31\-\-30 \& | | | \& 2 | 10\-\-11\-\-12\-\-13\-\-14 35\-\-36\-\-37\-\-38\-\-39 \& | | | \& 1 | 9\-\- 8\-\- 7\-\- 6\-\- 5 44\-\-43\-\-42\-\-41\-\-40 \& | | | \& Y=0 | 0\-\- 1\-\- 2\-\- 3\-\- 4 45\-\-46\-\-47\-\-48\-\-49\-\-50\-... \& | \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& X=0 1 2 3 4 5 6 7 8 9 10 .Ve .PP If the radix is even then the ends of each group don't join up. For example in radix 4 N=15 isn't next to N=16, nor N=31 to N=32, etc. .PP .Vb 1 \& radix => 4 \& \& 3 | 15\-\-14\-\-13\-\-12 16\-\-17\-\-18\-\-19 \& | | | \& 2 | 8\-\- 9\-\-10\-\-11 23\-\-22\-\-21\-\-20 \& | | | \& 1 | 7\-\- 6\-\- 5\-\- 4 24\-\-25\-\-26\-\-27 \& | | | \& Y=0 | 0\-\- 1\-\- 2\-\- 3 31\-\-30\-\-29\-\-28 32\-\-33\-... \& | \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& X=0 1 2 4 5 6 7 8 9 10 .Ve .PP Even sizes can be made to join using other patterns, but this module is just Peano's digit construction. For joining up in 2x2 groupings see \&\f(CW\*(C`HilbertCurve\*(C'\fR (which is essentially the only way to join up in 2x2). For bigger groupings there's various ways. .SS "Unit Square" .IX Subsection "Unit Square" Peano's original form was for filling a unit square by mapping a number T in the range 0 .Sp .RE .PP The base \*(L"S\*(R" pattern in this form is the same, but turned 45 degrees and line segments making diagonals through the squares, per the \*(L"..\*(R" marked lines in the following. .PP .Vb 10 \& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ \& | .. | .. | .. | | | | | \& |6 .. |7 .. |8 .. | | 6\-\-\-\-\-\-\-\-7\-\-\-\-\-\-\-\-8 | \& | .. | .. | .. | | | | | | \& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ +\-\-\-\-|\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ \& | .. | .. | .. | | | | | | \& | .. 5| .. 4| .. 3| | 5\-\-\-\-\-\-\-\-4\-\-\-\-\-\-\-\-3 | \& | .. | .. | .. | | | | | | \& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-|\-\-\-+ \& | .. | .. | .. | | | | | | \& |0 .. |1 .. |2 .. | | 0\-\-\-\-\-\-\-\-1\-\-\-\-\-\-\-\-2 | \& | .. | .. | .. | | | | | \& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+ \& \& X==Y mod 2 "even" points leading\-diagonal "/" \& X!=Y mod 2 "odd" points opposite\-diagonal "\e" .Ve .PP Rounding off the corners of the diagonal form so they don't touch can help show the equivalence, .PP .Vb 11 \& \-\-\-\-\-7 / \& / \e / \& 6 \-\-\-\-\-8 \& | \& | 4\-\-\-\-\- \& \e / \e \& 5\-\-\-\-\- 3 \& | \& \-\-\-\-\-1 | \& / \e / \& 0 \-\-\-\-\-2 .Ve .SS "Power of 3 Patterns" .IX Subsection "Power of 3 Patterns" Plotting sequences of values with some connection to ternary digits or powers of 3 will usually give the most interesting patterns on the Peano curve. For example the Mephisto waltz sequence (eg. Math::NumSeq::MephistoWaltz) makes diamond shapes, .PP .Vb 10 \& ** * *** * * *** ** *** ** *** ** ** * * \& * * ** ** *** ** *** * * ** ** *** ** *** \& *** ** *** ** ** * *** * *** * * *** ** \& ** *** * * *** * ** ** *** * * *** * ** \& *** ** *** ** ** * *** * *** * * *** ** \& * * ** ** *** ** *** * * ** ** *** ** *** \& *** ** *** ** ** * *** * *** * * *** ** \& ** *** * * *** * ** ** *** * * *** * ** \& ** * *** * * *** ** *** ** *** ** ** * * \& * * ** ** *** ** *** * * ** ** *** ** *** \& ** * *** * * *** ** *** ** *** ** ** * * \& ** *** * * *** * ** ** *** * * *** * ** \& *** ** *** ** ** * *** * *** * * *** ** \& ** *** * * *** * ** ** *** * * *** * ** \& ** * *** * * *** ** *** ** *** ** ** * * \& ** *** * * *** * ** ** *** * * *** * ** \& *** ** *** ** ** * *** * *** * * *** ** \& * * ** ** *** ** *** * * ** ** *** ** *** \& *** ** *** ** ** * *** * *** * * *** ** \& ** *** * * *** * ** ** *** * * *** * ** \& ** * *** * * *** ** *** ** *** ** ** * * \& * * ** ** *** ** *** * * ** ** *** ** *** \& ** * *** * * *** ** *** ** *** ** ** * * \& ** *** * * *** * ** ** *** * * *** * ** \& ** * *** * * *** ** *** ** *** ** ** * * \& * * ** ** *** ** *** * * ** ** *** ** *** \& *** ** *** ** ** * *** * *** * * *** ** .Ve .PP This arises from each 3x3 block in the Mephisto waltz being one of two shapes which are then flipped by the Peano pattern .PP .Vb 3 \& * * _ _ _ * \& * _ _ or _ * * (inverse) \& _ _ * * * _ \& \& 0,0,1, 0,0,1, 1,1,0 1,1,0, 1,1,0, 0,0,1 .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::PeanoCurve\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::PeanoCurve\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::PeanoCurve->new ()" .PD 0 .ie n .IP """$path = Math::PlanePath::PeanoCurve\->new (radix => $integer)""" 4 .el .IP "\f(CW$path = Math::PlanePath::PeanoCurve\->new (radix => $integer)\fR" 4 .IX Item "$path = Math::PlanePath::PeanoCurve->new (radix => $integer)" .PD Create and return a new path object. .Sp The optional \f(CW\*(C`radix\*(C'\fR parameter gives the base for digit splitting. The default is ternary \f(CW\*(C`radix => 3\*(C'\fR. .ie n .IP """($x,$y) = $path\->n_to_xy ($n)""" 4 .el .IP "\f(CW($x,$y) = $path\->n_to_xy ($n)\fR" 4 .IX Item "($x,$y) = $path->n_to_xy ($n)" Return the X,Y coordinates of point number \f(CW$n\fR on the path. Points begin at 0 and if \f(CW\*(C`$n < 0\*(C'\fR then the return is an empty list. .Sp 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. .ie n .IP """$n = $path\->xy_to_n ($x,$y)""" 4 .el .IP "\f(CW$n = $path\->xy_to_n ($x,$y)\fR" 4 .IX Item "$n = $path->xy_to_n ($x,$y)" Return an integer point number for coordinates \f(CW\*(C`$x,$y\*(C'\fR. Each integer N is considered the centre of a unit square and an \f(CW\*(C`$x,$y\*(C'\fR within that square returns N. .ie n .IP """($n_lo, $n_hi) = $path\->rect_to_n_range ($x1,$y1, $x2,$y2)""" 4 .el .IP "\f(CW($n_lo, $n_hi) = $path\->rect_to_n_range ($x1,$y1, $x2,$y2)\fR" 4 .IX Item "($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 \&\f(CW$x1\fR,\f(CW$y1\fR and \f(CW$x2\fR,\f(CW$y2\fR. 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. .Sp The returned range is exact, meaning \f(CW$n_lo\fR and \f(CW$n_hi\fR are the smallest and biggest in the rectangle. .SS "Level Methods" .IX Subsection "Level Methods" .ie n .IP """($n_lo, $n_hi) = $path\->level_to_n_range($level)""" 4 .el .IP "\f(CW($n_lo, $n_hi) = $path\->level_to_n_range($level)\fR" 4 .IX Item "($n_lo, $n_hi) = $path->level_to_n_range($level)" Return \f(CW\*(C`(0, $radix**(2*$level) \- 1)\*(C'\fR. .SH "FORMULAS" .IX Header "FORMULAS" .SS "N to X,Y" .IX Subsection "N to X,Y" Peano's calculation is based on putting base\-3 digits of N alternately to X or Y. From the high end of N a digit is appended to Y then the next appended to X. Beginning at an even digit position in N makes the last digit go to X so the first N=0,1,2 goes along the X axis. .PP At each stage a \*(L"complement\*(R" state is maintained for X and for Y. When complemented the digit is reversed to 2\ \-\ digit, so 0,1,2 becomes 2,1,0. This reverses the direction so points like N=12,13,14 shown above go to the left, or groups like 9,10,11 then 12,13,14 then 15,16,17 go downwards. .PP The complement is calculated by adding the digits from N which went to the other one of X or Y. So the X complement is the sum of digits which have gone to Y so far. Conversely the Y complement is the sum of digits put to X. If the complement sum is odd then the reversal is done. A bitwise \&\s-1XOR\s0 can be used instead of a sum to accumulate odd/even\-ness the same way as a sum. .PP When forming the complement state the original digits from N are added, before applying any complementing for putting them to X or Y. If the radix is odd, like the default 3, then complementing doesn't change it mod 2 so either before or after is fine, but if the radix is even then it's not the same. .PP It also works to take the base\-3 digits of N from low to high, generating low to high digits in X and Y. When an odd digit is put to X then the low digits of Y so far must be complemented as 22..22\ \-\ Y (the 22..22 value being all 2s in base 3, ie. 3^k\-1). Conversely if an odd digit is put to Y then X must be complemented. With this approach the high digit position in N doesn't have to be found, but instead peel off digits of N from the low end. But the subtract to complement is then more work if using bignums. .SS "X,Y to N" .IX Subsection "X,Y to N" The X,Y to N calculation can be done by an inverse of either the high to low or low to high methods above. In both cases digits are put alternately from X and Y onto N, with complement as necessary. .PP For the low to high approach it's not easy to complement just the X digits in the N constructed so far, but it works to build and complement the X and Y digits separately then at the end interleave to make the final N. Complementing is the ternary equivalent of an \s-1XOR\s0 in binary. On a ternary machine some trit-twiddling could no doubt do it. .PP For the low to high with even radix the complementing is also tricky since changing the accumulated X affects the digits of Y below that, and vice versa. What's the rule? Is it alternate digits which end up complemented? In any case the current \f(CW\*(C`xy_to_n()\*(C'\fR code goes high to low which is easier, but means breaking the X,Y inputs into arrays of digits before beginning. .SS "N to abs(dX),abs(dY)" .IX Subsection "N to abs(dX),abs(dY)" The curve goes horizontally or vertically according to the number of trailing \*(L"2\*(R" digits when N is written in ternary, .PP .Vb 4 \& N trailing 2s direction abs(dX) abs(dY) \& \-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\- \& even horizontal 1 0 \& odd vertical 0 1 .Ve .PP For example N=5 is \*(L"12\*(R" in ternary has 1 trailing \*(L"2\*(R" which is odd so the step from N=5 to N=6 is vertical. .PP This works because when stepping from N to N+1 a carry propagates through the trailing 2s to increment the digit above. Digits go alternately to X or Y so odd or even trailing 2s put that carry into an X digit or Y digit. .PP .Vb 3 \& X Y X Y X \& N ... 2 2 2 2 \& N+1 1 0 0 0 0 carry propagates .Ve .SS "Rectangle to N Range" .IX Subsection "Rectangle to N Range" An easy over-estimate of the maximum N in a region can be had by going to the next bigger (3^k)x(3^k) square enclosing the region. This means the biggest X or Y rounded up to the next power of 3 (perhaps using \f(CW\*(C`log()\*(C'\fR if you trust its accuracy), so .PP .Vb 2 \& find k with 3^k > max(X,Y) \& N_hi = 3^(2k) \- 1 .Ve .PP An exact N range can be found by following the \*(L"high to low\*(R" N to X,Y procedure above. Start with the easy over-estimate to find a 3^(2k) ternary digit position in N bigger than the desired region, then choose a digit 0,1,2 for X, the biggest which overlaps some of the region. Or if there's an X complement then the smallest digit is the biggest N, again whichever overlaps the region. Then likewise for a digit of Y, etc. .PP Biggest and smallest N must maintain separate complement states as they track down different N digits. A single loop can be used since there's the same \*(L"2k\*(R" many digits of N to consider for both. .PP The N range of any shape can be done this way, not just a rectangle like \&\f(CW\*(C`rect_to_n_range()\*(C'\fR. The procedure only depends on asking whether a one-third sub-part of X or Y overlaps the target region or not. .SH "OEIS" .IX Header "OEIS" This path is in Sloane's Online Encyclopedia of Integer Sequences in several forms, .Sp .RS 4 (etc) .RE .PP .Vb 10 \& A163528 X coordinate \& A163529 Y coordinate \& A163530 X+Y coordinate sum \& A163531 X^2+Y^2 square of distance from origin \& A163532 dX, change in X \-1,0,1 \& A163533 dY, change in Y \-1,0,1 \& A014578 abs(dX) from n\-1 to n, 1=horiz 0=vertical \& thue\-morse count low 0\-bits + 1 mod 2 \& A182581 abs(dY) from n\-1 to n, 0=horiz 1=vertical \& thue\-morse count low 0\-bits mod 2 \& A163534 direction of each step (up,down,left,right) \& A163535 direction, transposed X,Y \& A163536 turn 0=straight,1=right,2=left \& A163537 turn, transposed X,Y \& A163342 diagonal sums \& A163479 diagonal sums divided by 6 \& \& A163480 N on X axis \& A163481 N on Y axis \& A163343 N on X=Y diagonal, 0,4,8,44,40,36,etc \& A163344 N on X=Y diagonal divided by 4 \& A007417 N+1 of positions of horizontals, ternary even trailing 0s \& A145204 N+1 of positions of verticals, ternary odd trailing 0s \& \& A163332 Peano N \-> ZOrder radix=3 N mapping \& and vice versa since is self\-inverse \& A163333 with ternary digit swaps before and after .Ve .PP And taking X,Y points by the Diagonals sequence, then the value of the following sequences is the N of the Peano curve at those positions. .PP .Vb 4 \& A163334 numbering by diagonals, from same axis as first step \& A163336 numbering by diagonals, from opposite axis \& A163338 A163334 + 1, Peano starting from N=1 \& A163340 A163336 + 1, Peano starting from N=1 .Ve .PP \&\f(CW\*(C`Math::PlanePath::Diagonals\*(C'\fR numbers points from the Y axis down, which is the opposite axis to the Peano curve first step along the X axis, so a plain \&\f(CW\*(C`Diagonals\*(C'\fR \-> \f(CW\*(C`PeanoCurve\*(C'\fR is the \*(L"opposite axis\*(R" form A163336. .PP These sequences are permutations of the integers since all X,Y positions of the first quadrant are reached eventually. The inverses are as follows. They can be thought of taking X,Y positions in the Peano curve order and then asking what N the Diagonals would put there. .PP .Vb 4 \& A163335 inverse of A163334 \& A163337 inverse of A163336 \& A163339 inverse of A163338 \& A163341 inverse of A163340 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::HilbertCurve, Math::PlanePath::ZOrderCurve, Math::PlanePath::AR2W2Curve, Math::PlanePath::BetaOmega, Math::PlanePath::CincoCurve, Math::PlanePath::KochelCurve, Math::PlanePath::WunderlichMeander .PP Math::PlanePath::KochCurve .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2010, 2011, 2012, 2013, 2014 Kevin Ryde .PP This file is part of Math-PlanePath. .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .