NAME
Math::PlanePath::ComplexPlus -- points in complex base i+r
SYNOPSIS
use Math::PlanePath::ComplexPlus;my $path = Math::PlanePath::ComplexPlus->new;my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION
This path traverses points by a complex number base i+r for integer r>=1. The default is base i+1
30 31 14 15 528 29 12 13 426 27 22 23 10 11 6 7 324 25 20 21 8 9 4 5 262 63 46 47 18 19 2 3 160 61 44 45 16 17 0 1 <- Y=058 59 54 55 42 43 38 39 -156 57 52 53 40 41 36 37 -250 51 94 95 34 35 78 79 -348 49 92 93 32 33 76 77 -490 91 86 87 74 75 70 71 -588 89 84 85 72 73 68 69 -6126 127 110 111 82 83 66 67 -7124 125 108 109 80 81 64 65 -8122 123 118 119 106 107 102 103 -9120 121 116 117 104 105 100 101 -10114 115 98 99 -11112 113 96 97 -12^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2
The shape of these points N=0 to N=2^k-1 inclusive is equivalent to the twindragon turned 135 degrees. Each complex base point corresponds to a unit square inside the twindragon curve (two DragonCurve back-to-back).
Real Part
Option "realpart => $r" selects another r for complex base b=i+r. For example
realpart => 245 46 47 48 49 840 41 42 43 44 735 36 37 38 39 630 31 32 33 34 525 26 27 28 29 20 21 22 23 24 415 16 17 18 19 310 11 12 13 14 25 6 7 8 9 10 1 2 3 4 <- Y=0^X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
N is broken into digits of a base norm=r*r+1, ie. digits 0 to r*r inclusive.
norm = r*r + 1Nstart = 0Nlevel = norm^level - 1
The low digit of N makes horizontal runs of r*r+1 many points, such as N=0 to N=4, then N=5 to N=9, etc shown above. In the default r=1 these runs are 2 long. For r=2 shown above they're 2*2+1=5 long, or r=3 would be 3*3+1=10, etc.
The offset for each successive run is i+r, ie. Y=1,X=r such as at N=5 shown above. Then the offset for the next level is (i+r)^2 = (2r*i + r^2-1) so N=25 begins at Y=2*r=4, X=r*r-1=3. In general each level adds an angle
angle = atan(1/r)Nlevel_angle = level * angle
So the points spiral around anti-clockwise. For r=1 the angle is atan(1/1)=45 degrees, so that for example level=4 is angle 4*45=180 degrees, putting N=2^4=16 on the negative X axis as shown in the first sample above.
As r becomes bigger the angle becomes smaller, making it spiral more slowly. The points never fill the plane, but the set of points N=0 to Nlevel are all touching.
Arms
For "realpart => 1", an optional "arms => 2" adds a second copy of the curve rotated 180 degrees and starting from X=0,Y=1. It meshes perfectly to fill the plane. Each arm advances successively so N=0,2,4,etc is the plain path and N=1,3,5,7,etc is the copy
arms=>260 62 28 30 556 58 24 26 452 54 44 46 20 22 12 14 348 50 40 42 16 18 8 10 236 38 3 1 4 6 35 33 132 34 7 5 0 2 39 37 <- Y=011 9 19 17 43 41 51 49 -115 13 23 21 47 45 55 53 -227 25 59 57 -331 29 63 61 -4^-6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6
There's no "arms" parameter for other "realpart" values as yet, only for i+1. Is there a good rotated arrangement for others? Do "norm" many copies fill the plane in general?
FUNCTIONS
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
- "$path = Math::PlanePath::ComplexPlus->new ()"
-
Create and return a new path object.
- "($x,$y) = $path->n_to_xy ($n)"
-
Return the X,Y coordinates of point number
$non the path. Points begin at 0 and if"$n < 0"then the return is an empty list.
Level Methods
- "($n_lo, $n_hi) = $path->level_to_n_range($level)"
-
Return
"(0, 2**$level - 1)", or for 2 arms return"(0, 2 * 2**$level -1)". With the"realpart"option return"(0, $norm**$level - 1)"where norm=realpart^2+1.
FORMULAS
Various formulas and pictures etc for the i+1 case can be found in the author's long mathematical write-up (section "Complex Base i+1")
<http://user42.tuxfamily.org/dragon/index.html>
OEIS
Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include
<http://oeis.org/A290885> (etc)
realpart=1 (i+1, the default)A290885 -XA290884 YA290886 norm X^2 + Y^2A146559 dX at N=2^k-1 (step to next replication level)A077950,A077870location of ComplexMinus origin in ComplexPlus(mirror horizontal even level, vertical odd level)
SEE ALSO
Math::PlanePath, Math::PlanePath::ComplexMinus, Math::PlanePath::ComplexRevolving, Math::PlanePath::DragonCurve
<http://user42.tuxfamily.org/dragon/index.html>
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/>.