1Math::PlanePath::QuadriUcsCeurrvCeo(n3t)ributed Perl DocMuamtehn:t:aPtliaonnePath::QuadricCurve(3)
2
3
4
6 Math::PlanePath::QuadricCurve -- eight segment zig-zag
7
9 use Math::PlanePath::QuadricCurve;
10 my $path = Math::PlanePath::QuadricCurve->new;
11 my ($x, $y) = $path->n_to_xy (123);
12
14 This is a self-similar zig-zag of eight segments,
15
16 18-19 5
17 | |
18 16-17 20 23-24 4
19 | | | |
20 15-14 21-22 25-26 3
21 | |
22 11-12-13 29-28-27 2
23 | |
24 2--3 10--9 30-31 58-59 ... 1
25 | | | | | | |
26 0--1 4 7--8 32 56-57 60 63-64 <- Y=0
27 | | | | | |
28 5--6 33-34 55-54 61-62 -1
29 | |
30 37-36-35 51-52-53 -2
31 | |
32 38-39 42-43 50-49 -3
33 | | | |
34 40-41 44 47-48 -4
35 | |
36 45-46 -5
37 ^
38 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
39
40 The base figure is the initial N=0 to N=8,
41
42 2---3
43 | |
44 0---1 4 7---8
45 | |
46 5---6
47
48 It then repeats, turned to follow edge directions, so N=8 to N=16 is
49 the same shape going upwards, then N=16 to N=24 across, N=24 to N=32
50 downwards, etc.
51
52 The result is the base at ever greater scale extending to the right and
53 with wiggly lines making up the segments. The wiggles don't overlap.
54
55 The name "QuadricCurve" here is a slight mistake. Mandelbrot ("Fractal
56 Geometry of Nature" 1982 page 50) calls any islands initiated from a
57 square "quadric", only one of which is with sides by this eight segment
58 expansion. This curve expansion also appears (unnamed) in Mandelbrot's
59 "How Long is the Coast of Britain", 1967.
60
61 Level Ranges
62 A given replication extends to
63
64 Nlevel = 8^level
65 X = 4^level
66 Y = 0
67
68 Ymax = 4^0 + 4^1 + ... + 4^level # 11...11 in base 4
69 = (4^(level+1) - 1) / 3
70 Ymin = - Ymax
71
72 Turn
73 The sequence of turns made by the curve is straightforward. In the
74 base 8 (octal) representation of N, the lowest non-zero digit gives the
75 turn
76
77 low digit turn (degrees)
78 --------- --------------
79 1 +90 L
80 2 -90 R
81 3 -90 R
82 4 0
83 5 +90 L
84 6 +90 L
85 7 -90 R
86
87 When the least significant digit is non-zero it determines the turn, to
88 make the base N=0 to N=8 shape. When the low digit is zero it's
89 instead the next level up, the N=0,8,16,24,etc shape which is in
90 control, applying a turn for the subsequent base part. So for example
91 at N=16 = 20 octal 20 is a turn -90 degrees.
92
94 See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
95 classes.
96
97 "$path = Math::PlanePath::QuadricCurve->new ()"
98 Create and return a new path object.
99
100 "($x,$y) = $path->n_to_xy ($n)"
101 Return the X,Y coordinates of point number $n on the path. Points
102 begin at 0 and if "$n < 0" then the return is an empty list.
103
104 Level Methods
105 "($n_lo, $n_hi) = $path->level_to_n_range($level)"
106 Return "(0, 8**$level)".
107
109 Entries in Sloane's Online Encyclopedia of Integer Sequences related to
110 this path include
111
112 <http://oeis.org/A133851> (etc)
113
114 A133851 Y at N=2^k, being successive powers 2^j at k=1mod4
115
117 Math::PlanePath, Math::PlanePath::QuadricIslands,
118 Math::PlanePath::KochCurve
119
120 Math::Fractal::Curve -- its examples/generator4.pl is this curve
121
123 <http://user42.tuxfamily.org/math-planepath/index.html>
124
126 Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 Kevin Ryde
127
128 This file is part of Math-PlanePath.
129
130 Math-PlanePath is free software; you can redistribute it and/or modify
131 it under the terms of the GNU General Public License as published by
132 the Free Software Foundation; either version 3, or (at your option) any
133 later version.
134
135 Math-PlanePath is distributed in the hope that it will be useful, but
136 WITHOUT ANY WARRANTY; without even the implied warranty of
137 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
138 General Public License for more details.
139
140 You should have received a copy of the GNU General Public License along
141 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
142
143
144
145perl v5.28.0 2017-12-03 Math::PlanePath::QuadricCurve(3)