NAME
Math::PlanePath::WunderlichSerpentine -- transpose parts of Peano curve, including coil order
SYNOPSIS
use Math::PlanePath::WunderlichSerpentine;
my $path = Math::PlanePath::WunderlichSerpentine->new (serpentine_type => '111_000_111');
my ($x, $y) = $path->n_to_xy (123);
# or another radix digits ...
my $path5 = Math::PlanePath::WunderlichSerpentine->new (radix => 5);
DESCRIPTION
This is an integer version of Walter Wunderlich's variations on the PeanoCurve
.
Walter Wunderlich, "Uber Peano-Kurven", Elemente der Mathematik, volume 28, number 1, 1973, pages 1-10. http://sodwana.uni-ak.ac.at/geom/mitarbeiter/wallner/wunderlich/, http://sodwana.uni-ak.ac.at/geom/mitarbeiter/wallner/wunderlich/pdf/125.pdf
A "serpentine type" controls transposing of selected 3x3 sub-parts. The default is "alternating" 010,101,010 which transposes every second sub-part,
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
serpentine_type
can be a string of 0s and 1s, with optional space, comma or _ separators at each group of 3,
"011111011" 0/1 string
"011,111,011"
"011_111_011"
"011 111 011"
or special values
"alternating" 01010101.. the default
"coil" 11111... all 1s described below
"Peano" 00000... all 0s, gives PeanoCurve
Each "1" sub-part is transposed. The string is applied in order of the N parts, irrespective of what net reversals and transposes are in force on a particular part.
When no parts are transposed, which is a string of all 0s, the result is the same as the PeanoCurve
. The special serpentine_type => "Peano"
gives that.
Coil Order
serpentine_type => "coil"
means "111 111 111" to transpose all parts. The result is like a coil viewed side-on,
8 24--25--26--27--28--29 78--79--80--81--...
| | |
7 23--22--21 32--31--30 77--76--75
| | |
6 18--19--20 33--34--35 72--73--74
| | |
5 17--16--15 38--37--36 71--70--69
| | |
4 12--13--14 39--40--41 66--67--68
| | |
3 11--10-- 9 44--43--42 65--64--63
| | |
2 6-- 7-- 8 45--46--47 60--61--62
| | |
1 5-- 4-- 3 50--49--48 59--58--57
| | |
Y=0 0-- 1-- 2 51--52--53--54--55--56
X=0 1 2 3 4 5 6 7 8
Whenever serpentine_type
begins with a "1", the initial sub-part is transposed at each level. The first step N=0 to N=1 is kept fixed along the X axis, then the higher levels are transposed. For example in the coil above The N=9 to N=17 part is upwards, and then the N=81 to N=161 part is to the right, and so on.
Radix
The optional radix
parameter gives the size of the sub-parts, similar to the PeanoCurve
radix
parameter (see "Radix" in Math::PlanePath::PeanoCurve). For example radix 5 gives
radix => 5
4 | 20-21-22-23-24-25 34-35 44-45 70-71-72-73-74-75 84-85
| | | | | | | | | | |
3 | 19-18-17-16-15 26 33 36 43 46 69-68-67-66-65 76 83 86
| | | | | | | | | | |
2 | 10-11-12-13-14 27 32 37 42 47 60-61-62-63-64 77 82 87
| | | | | | | | | | |
1 | 9--8--7--6--5 28 31 38 41 48 59-58-57-56-55 78 81 88
| | | | | | | | | | |
Y=0 | 0--1--2--3--4 29-30 39-40 49-50-51-52-53-54 79-80 89-..
+---------------------------------------------------------
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Like the PeanoCurve
, if the radix is even then the ends of each sub-part don't join up. For example in radix 4 N=15 isn't next to N=16, nor N=31 to N=32, etc.
| |
3 | 15--14--13--12 16 23--24 31 47--46--45--44 48 55--56 63
| | | | | | | | | | |
2 | 8-- 9--10--11 17 22 25 30 40--41--42--43 49 54 57 62
| | | | | | | | | | |
1 | 7-- 6-- 5-- 4 18 21 26 29 39--38--37--36 50 53 58 61
| | | | | | | | | | |
Y=0 | 0-- 1-- 2-- 3 19--20 27--28 32--33--34--35 51--52 59--60
+----------------------------------------------------------------
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
In the serpentine_type
0,1 form, space, comma, etc, separators should group radix
many values, so for example
serpentine_type => "00000_11111_00000_00000_11111"
The intention is to do something friendly if the separators are not on such boundaries, so that say 000_111_000 can have a sensible meaning in a radix higher than 3. But exactly what is not settled, so always give a full string of desired 0,1 for now.
FUNCTIONS
See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes.
$path = Math::PlanePath::WunderlichSerpentine->new ()
$path = Math::PlanePath::WunderlichSerpentine->new (serpentine_type => $str, 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.
SEE ALSO
Math::PlanePath, Math::PlanePath::PeanoCurve
HOME PAGE
http://user42.tuxfamily.org/math-planepath/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde
This file is part of Math-PlanePath.
Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.