1Math::PlanePath::WunderUlsiecrhSCeornpternitbiuntee(d3M)Paetrhl::DPolcaunmeePnattaht:i:oWnunderlichSerpentine(3)
2
3
4
6 Math::PlanePath::WunderlichSerpentine -- transpose parts of Peano
7 curve, including coil order
8
10 use Math::PlanePath::WunderlichSerpentine;
11 my $path = Math::PlanePath::WunderlichSerpentine->new (serpentine_type => '111_000_111');
12 my ($x, $y) = $path->n_to_xy (123);
13
14 # or another radix digits ...
15 my $path5 = Math::PlanePath::WunderlichSerpentine->new (radix => 5);
16
18 This is an integer version of Walter Wunderlich's variations on the
19 "PeanoCurve". A "serpentine type" controls transposing of selected 3x3
20 sub-parts. The default is "alternating" 010,101,010 which transposes
21 every second sub-part,
22
23 8 | 60--61--62--63 68--69 78--79--80--81
24 | | | | | | |
25 7 | 59--58--57 64 67 70 77--76--75 ...
26 | | | | | |
27 6 | 54--55--56 65--66 71--72--73--74
28 | |
29 5 | 53 48--47 38--37--36--35 30--29
30 | | | | | | | |
31 4 | 52 49 46 39--40--41 34 31 28
32 | | | | | | | |
33 3 | 51--50 45--44--43--42 33--32 27
34 | |
35 2 | 6-- 7-- 8-- 9 14--15 24--25--26
36 | | | | | |
37 1 | 5-- 4-- 3 10 13 16 23--22--21
38 | | | | | |
39 Y=0 | 0-- 1-- 2 11--12 17--18--19--20
40 |
41 +-------------------------------------
42 X=0 1 2 3 4 5 6 7 8
43
44 "serpentine_type" can be a string of 0s and 1s, with optional space,
45 comma or _ separators at each group of 3,
46
47 "011111011" 0/1 string
48 "011,111,011"
49 "011_111_011"
50 "011 111 011"
51
52 or special values
53
54 "alternating" 01010101.. the default
55 "coil" 11111... all 1s described below
56 "Peano" 00000... all 0s, gives PeanoCurve
57
58 Each "1" sub-part is transposed. The string is applied in order of the
59 N parts, irrespective of what net reversals and transposes are in force
60 on a particular part.
61
62 When no parts are transposed, which is a string of all 0s, the result
63 is the same as the "PeanoCurve". The special "serpentine_type =>
64 "Peano"" gives that.
65
66 Coil Order
67 "serpentine_type => "coil"" means "111 111 111" to transpose all parts.
68 The result is like a coil viewed side-on,
69
70 8 24--25--26--27--28--29 78--79--80--81--...
71 | | |
72 7 23--22--21 32--31--30 77--76--75
73 | | |
74 6 18--19--20 33--34--35 72--73--74
75 | | |
76 5 17--16--15 38--37--36 71--70--69
77 | | |
78 4 12--13--14 39--40--41 66--67--68
79 | | |
80 3 11--10-- 9 44--43--42 65--64--63
81 | | |
82 2 6-- 7-- 8 45--46--47 60--61--62
83 | | |
84 1 5-- 4-- 3 50--49--48 59--58--57
85 | | |
86 Y=0 0-- 1-- 2 51--52--53--54--55--56
87
88 X=0 1 2 3 4 5 6 7 8
89
90 Whenever "serpentine_type" begins with a "1" the initial sub-part is
91 transposed at each level. The first step N=0 to N=1 is kept fixed
92 along the X axis, then the higher levels are transposed. For example
93 in the coil above The N=9 to N=17 part is upwards, and then the N=81 to
94 N=161 part is to the right, and so on.
95
96 Radix
97 The optional "radix" parameter gives the size of the sub-parts, similar
98 to the "PeanoCurve" "radix" parameter (see "Radix" in
99 Math::PlanePath::PeanoCurve). For example radix 5 gives
100
101 radix => 5
102
103 4 | 20-21-22-23-24-25 34-35 44-45 70-71-72-73-74-75 84-85
104 | | | | | | | | | | |
105 3 | 19-18-17-16-15 26 33 36 43 46 69-68-67-66-65 76 83 86
106 | | | | | | | | | | |
107 2 | 10-11-12-13-14 27 32 37 42 47 60-61-62-63-64 77 82 87
108 | | | | | | | | | | |
109 1 | 9--8--7--6--5 28 31 38 41 48 59-58-57-56-55 78 81 88
110 | | | | | | | | | | |
111 Y=0 | 0--1--2--3--4 29-30 39-40 49-50-51-52-53-54 79-80 89-..
112 +---------------------------------------------------------
113 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
114
115 Like the "PeanoCurve" if the radix is even then the ends of each sub-
116 part don't join up. For example in radix 4 N=15 isn't next to N=16,
117 nor N=31 to N=32, etc.
118
119 | |
120 3 | 15--14--13--12 16 23--24 31 47--46--45--44 48 55--56 63
121 | | | | | | | | | | |
122 2 | 8-- 9--10--11 17 22 25 30 40--41--42--43 49 54 57 62
123 | | | | | | | | | | |
124 1 | 7-- 6-- 5-- 4 18 21 26 29 39--38--37--36 50 53 58 61
125 | | | | | | | | | | |
126 Y=0 | 0-- 1-- 2-- 3 19--20 27--28 32--33--34--35 51--52 59--60
127 +----------------------------------------------------------------
128 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
129
130 In the "serpentine_type" 0,1 form, any space, comma, etc, separators
131 should group "radix" many values, so for example
132
133 serpentine_type => "00000_11111_00000_00000_11111"
134
135 The intention is to do something friendly if the separators are not on
136 such boundaries, so that say 000_111_000 can have a sensible meaning in
137 a radix higher than 3. But exactly what is not settled, so always give
138 a full string of desired 0,1 for now.
139
141 See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path
142 classes.
143
144 "$path = Math::PlanePath::WunderlichSerpentine->new ()"
145 "$path = Math::PlanePath::WunderlichSerpentine->new (serpentine_type =>
146 $str, radix => $r)"
147 Create and return a new path object.
148
149 The optional "radix" parameter gives the base for digit splitting.
150 The default is ternary, radix 3. The radix should be an odd
151 number, 3, 5, 7, 9 etc.
152
154 Math::PlanePath, Math::PlanePath::PeanoCurve
155
156 Walter Wunderlich "Uber Peano-Kurven", Elemente der Mathematik,
157 28(1):1-10, 1973.
158 <http://sodwana.uni-ak.ac.at/geom/mitarbeiter/wallner/wunderlich/>
159 <http://sodwana.uni-ak.ac.at/geom/mitarbeiter/wallner/wunderlich/pdf/125.pdf>
160
162 <http://user42.tuxfamily.org/math-planepath/index.html>
163
165 Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
166
167 This file is part of Math-PlanePath.
168
169 Math-PlanePath is free software; you can redistribute it and/or modify
170 it under the terms of the GNU General Public License as published by
171 the Free Software Foundation; either version 3, or (at your option) any
172 later version.
173
174 Math-PlanePath is distributed in the hope that it will be useful, but
175 WITHOUT ANY WARRANTY; without even the implied warranty of
176 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
177 General Public License for more details.
178
179 You should have received a copy of the GNU General Public License along
180 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
181
182
183
184perl v5.32.0 2020-M0a7t-h2:8:PlanePath::WunderlichSerpentine(3)