.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 >0, 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 .\" ======================================================================== .\" .IX Title "Math::PlanePath::AlternatePaperMidpoint 3pm" .TH Math::PlanePath::AlternatePaperMidpoint 3pm "2021-01-23" "perl v5.32.0" "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::AlternatePaperMidpoint \-\- alternate paper folding midpoints .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::AlternatePaperMidpoint; \& my $path = Math::PlanePath::AlternatePaperMidpoint\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the midpoints of each alternate paper folding curve (Math::PlanePath::AlternatePaper). .PP .Vb 10 \& 8 | 64\-65\-... \& | | \& 7 | 63 \& | | \& 6 | 20\-21 62 \& | | | | \& 5 | 19 22 61\-60\-59 \& | | | | \& 4 | 16\-17\-18 23 56\-57\-58 \& | | | | \& 3 | 15 26\-25\-24 55 50\-49\-48\-47 \& | | | | | | \& 2 | 4\-\-5 14 27\-28\-29 54 51 36\-37 46 \& | | | | | | | | | | \& 1 | 3 6 13\-12\-11 30 53\-52 35 38 45\-44\-43 \& | | | | | | | | \& Y=0 | 0\-\-1\-\-2 7\-\-8\-\-9\-10 31\-32\-33\-34 39\-40\-41\-42 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 .Ve .PP The \f(CW\*(C`AlternatePaper\*(C'\fR curve begins as follows and the midpoints are numbered from 0, .PP .Vb 12 \& | \& 9 \& | \& \-\-8\-\- \& | | \& 7 | \& | | \& \-\-2\-\- \-\-6\-\- \& | | | \& 1 3 5 \& | | | \& *\-\-0\-\- \-\-4\-\- .Ve .PP These midpoints are on fractions X=0.5,Y=0, X=1,Y=0.5, etc. For this \&\f(CW\*(C`AlternatePaperMidpoint\*(C'\fR they're turned 45 degrees and mirrored so the 0,1,2 upward diagonal becomes horizontal along the X axis, and the 2,3,4 downward diagonal becomes a vertical at X=2, extending to X=2,Y=2 at N=4. .PP The midpoints are distinct X,Y positions because the alternate paper curve traverses each edge only once. .PP The curve is self-similar in 2^level sections due to its unfolding. This can be seen in the midpoints as for example N=0 to N=16 above is the same shape as N=16 to N=32, but the latter rotated +90 degrees and numbered in reverse. .SS "Arms" .IX Subsection "Arms" The midpoints fill an eighth of the plane and eight copies can mesh together perfectly when mirrored and rotated by 90, 180 and 270 degrees. The \f(CW\*(C`arms\*(C'\fR parameter can choose 1 to 8 curve arms successively advancing. .PP For example \f(CW\*(C`arms => 8\*(C'\fR begins as follows. N=0,8,16,24,etc is the first arm, the same as the plain curve above. N=1,9,17,25 is the second, N=2,10,18,26 the third, etc. .PP .Vb 10 \& 90\-82 81\-89 7 \& arms => 8 | | | | \& ... 74 73 ... 6 \& | | \& 66 65 5 \& | | \& 43\-35 42\-50\-58 57\-49\-41 4 \& | | | | \& 91\-.. 51 27 34\-26\-18 17\-25\-33 3 \& | | | | | \& 83\-75\-67\-59 19\-11\-\-3 10 9 32\-40 2 \& | | | | \& 84\-76\-68\-60 20\-12\-\-4 2 1 24 48 ..\-88 1 \& | | | | | | \& 92\-.. 52 28 5 6 0\-\-8\-16 56\-64\-72\-80 <\- Y=0 \& | | | | \& 44\-36 13 14 7\-15\-23 63\-71\-79\-87 \-1 \& | | | | | \& 37\-29\-21 22\-30\-38 31 55 ..\-95 \-2 \& | | | | \& 45\-53\-61 62\-54\-46 39\-47 \-3 \& | | \& 69 70 \-4 \& | | \& ... 77 78 ... \-5 \& | | | | \& 93\-85 86\-94 \-6 \& \& ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ \& \-7 \-6 \-5 \-4 \-3 \-2 \-1 X=0 1 2 3 4 5 6 .Ve .PP With eight arms like this every X,Y point is visited exactly once, because the 8\-arm \f(CW\*(C`AlternatePaper\*(C'\fR traverses every edge exactly once (\*(L"Arms\*(R" in Math::PlanePath::AlternatePaper). .PP The arm numbering doesn't correspond to the \f(CW\*(C`AlternatePaper\*(C'\fR, due to the rotate and reflect of the first arm. It ends up arms 0 and 1 of the \&\f(CW\*(C`AlternatePaper\*(C'\fR corresponding to arms 7 and 0 of the midpoints here, those two being a pair going horizontally corresponding to a pair in the \&\f(CW\*(C`AlternatePaper\*(C'\fR going diagonally into a quadrant. .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::AlternatePaperMidpoint\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::AlternatePaperMidpoint\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::AlternatePaperMidpoint->new ()" Create and return a new path object. .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. .ie n .IP """$n = $path\->n_start()""" 4 .el .IP "\f(CW$n = $path\->n_start()\fR" 4 .IX Item "$n = $path->n_start()" Return 0, the first N in the path. .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, 2**$level \- 1)\*(C'\fR, or for multiple arms return \f(CW\*(C`(0, $arms * (2**$level \- 1)*$arms)\*(C'\fR. This is the same as the \f(CW\*(C`DragonMidpoint\*(C'\fR. .SH "OEIS" .IX Header "OEIS" Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include .Sp .RS 4 (etc) .RE .PP .Vb 3 \& A334576 X coordinate \& A334577 Y coordinate \& A016116 X/2 at N=2^k, being X/2=2^floor(k/2) .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::AlternatePaper .PP Math::PlanePath::DragonMidpoint, Math::PlanePath::R5DragonMidpoint, Math::PlanePath::TerdragonMidpoint .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde .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 .