1Math::PlanePath::TerdraUgsoenrRoCuonndterdi(b3u)ted PerlMaDtohc:u:mPelnatnaetPiaotnh::TerdragonRounded(3)
2
3
4
6 Math::PlanePath::TerdragonRounded -- triangular dragon curve, with
7 rounded corners
8
10 use Math::PlanePath::TerdragonRounded;
11 my $path = Math::PlanePath::TerdragonRounded->new;
12 my ($x, $y) = $path->n_to_xy (123);
13
14 # or another radix digits ...
15 my $path5 = Math::PlanePath::TerdragonRounded->new (radix => 5);
16
18 This is a version of the terdragon curve with rounded-off corners,
19
20 ... 44----43 14
21 \ / \
22 46----45 . 42 13
23 /
24 . 40----41 12
25 /
26 39 . 24----23 20----19 11
27 \ / \ / \
28 . 38 25 . 22----21 . 18 10
29 / \ /
30 36----37 . 26----27 . 16----17 9
31 / \ /
32 35 . 32----31 . 28 15 . 8
33 \ / \ / \
34 34----33 30----29 . 14 7
35 /
36 . 12----13 . 6
37 /
38 11 . 8-----7 5
39 \ / \
40 10-----9 . 6 4
41 /
42 . 4-----5 3
43 /
44 3 2
45 \
46 . 2 1
47 /
48 . 0-----1 . <- Y=0
49
50 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
51 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7 8
52
53 The plain "TerdragonCurve" is tripled in size and two points on each
54 3-long edge are visited by the "TerdragonRounded" here.
55
56 Arms
57 Multiple copies of the curve can be selected, each advancing
58 successively. The curve is 1/6 of the plane (like the plain terdragon)
59 and 6 arms rotated by 60, 120, 180, 240 and 300 degrees mesh together
60 perfectly.
61
62 "arms => 6" begins as follows. N=0,6,12,18,etc is the first arm (the
63 curve shown above), then N=1,7,13,19 the second copy rotated 60
64 degrees, N=2,8,14,20 the third rotated 120, etc.
65
66 arms=>6 43----37 72--...
67 / \ /
68 ... 49 31 66 48----42
69 / \ / \ / \
70 73 55 25 60----54 36
71 \ / \ /
72 67----61 19----13 24----30
73 \ /
74 38----32 14-----8 7 18 71---...
75 / \ / \ / \ /
76 44 26----20 2 1 12 65
77 \ / \
78 50----56 9-----3 . 0-----6 59----53
79 \ / \
80 ... 62 15 4 5 23----29 47
81 \ / \ / \ / \ /
82 74----68 21 10 11----17 35----41
83 / \
84 33----27 16----22 64----70
85 / \ / \
86 39 57----63 28 58 76
87 \ / \ / \ /
88 45----51 69 34 52 ...
89 / \ /
90 ...--75 40----46
91
92 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
93 -11-10-9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7 8 9 10 11
94
96 See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path
97 classes.
98
99 "$path = Math::PlanePath::TerdragonRounded->new ()"
100 "$path = Math::PlanePath::TerdragonRounded->new (arms => $count)"
101 Create and return a new path object.
102
103 "($x,$y) = $path->n_to_xy ($n)"
104 Return the X,Y coordinates of point number $n on the path. Points
105 begin at 0 and if "$n < 0" then the return is an empty list.
106
107 Fractional positions give an X,Y position along a straight line
108 between the integer positions.
109
110 Level Methods
111 "($n_lo, $n_hi) = $path->level_to_n_range($level)"
112 Return "(0, 2 * 3**$level - 1)", or for multiple arms return "(0, 2
113 * $arms * 3**$level - 1)".
114
115 These level ranges are like "TerdragonMidpoint" but with 2 points
116 on each line segment terdragon line segment instead of 1.
117
119 X,Y Visited
120 When arms=6 all "hex centred" points of the plane are visited, being
121 those points with
122
123 X+3Y mod 6 == 2 or 4 "hex_centred"
124
126 Math::PlanePath, Math::PlanePath::TerdragonCurve,
127 Math::PlanePath::TerdragonMidpoint, Math::PlanePath::DragonRounded
128
129 Jorg Arndt "http://www.jjj.de/fxt/#fxtbook" section 1.31.4 "Terdragon
130 and Hexdragon", where this rounded terdragon is called hexdragon.
131
133 <http://user42.tuxfamily.org/math-planepath/index.html>
134
136 Copyright 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
137
138 This file is part of Math-PlanePath.
139
140 Math-PlanePath is free software; you can redistribute it and/or modify
141 it under the terms of the GNU General Public License as published by
142 the Free Software Foundation; either version 3, or (at your option) any
143 later version.
144
145 Math-PlanePath is distributed in the hope that it will be useful, but
146 WITHOUT ANY WARRANTY; without even the implied warranty of
147 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
148 General Public License for more details.
149
150 You should have received a copy of the GNU General Public License along
151 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
152
153
154
155perl v5.32.0 2020-07-2M8ath::PlanePath::TerdragonRounded(3)