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