.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::PlanePath::ComplexPlus 3pm" .TH Math::PlanePath::ComplexPlus 3pm "2021-01-23" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::ComplexPlus \-\- points in complex base i+r .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::ComplexPlus; \& my $path = Math::PlanePath::ComplexPlus\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This path traverses points by a complex number base i+r for integer r>=1. The default is base i+1 .PP .Vb 10 \& 30 31 14 15 5 \& 28 29 12 13 4 \& 26 27 22 23 10 11 6 7 3 \& 24 25 20 21 8 9 4 5 2 \& 62 63 46 47 18 19 2 3 1 \& 60 61 44 45 16 17 0 1 <\- Y=0 \& 58 59 54 55 42 43 38 39 \-1 \& 56 57 52 53 40 41 36 37 \-2 \& 50 51 94 95 34 35 78 79 \-3 \& 48 49 92 93 32 33 76 77 \-4 \& 90 91 86 87 74 75 70 71 \-5 \& 88 89 84 85 72 73 68 69 \-6 \& 126 127 110 111 82 83 66 67 \-7 \& 124 125 108 109 80 81 64 65 \-8 \& 122 123 118 119 106 107 102 103 \-9 \& 120 121 116 117 104 105 100 101 \-10 \& 114 115 98 99 \-11 \& 112 113 96 97 \-12 \& \& ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ \& \-10 \-9 \-8 \-7 \-6 \-5 \-4 \-3 \-2 \-1 X=0 1 2 .Ve .PP 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). .SS "Real Part" .IX Subsection "Real Part" Option \f(CW\*(C`realpart => $r\*(C'\fR selects another r for complex base b=i+r. For example .PP .Vb 10 \& realpart => 2 \& 45 46 47 48 49 8 \& 40 41 42 43 44 7 \& 35 36 37 38 39 6 \& 30 31 32 33 34 5 \& 25 26 27 28 29 20 21 22 23 24 4 \& 15 16 17 18 19 3 \& 10 11 12 13 14 2 \& 5 6 7 8 9 1 \& 0 1 2 3 4 <\- Y=0 \& \& ^ \& X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .Ve .PP N is broken into digits of a base norm=r*r+1, ie. digits 0 to r*r inclusive. .PP .Vb 3 \& norm = r*r + 1 \& Nstart = 0 \& Nlevel = norm^level \- 1 .Ve .PP 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. .PP 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 .PP .Vb 2 \& angle = atan(1/r) \& Nlevel_angle = level * angle .Ve .PP 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. .PP 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. .SS "Arms" .IX Subsection "Arms" For \f(CW\*(C`realpart => 1\*(C'\fR, an optional \f(CW\*(C`arms => 2\*(C'\fR 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 .PP .Vb 1 \& arms=>2 \& \& 60 62 28 30 5 \& 56 58 24 26 4 \& 52 54 44 46 20 22 12 14 3 \& 48 50 40 42 16 18 8 10 2 \& 36 38 3 1 4 6 35 33 1 \& 32 34 7 5 0 2 39 37 <\- Y=0 \& 11 9 19 17 43 41 51 49 \-1 \& 15 13 23 21 47 45 55 53 \-2 \& 27 25 59 57 \-3 \& 31 29 63 61 \-4 \& \& ^ \& \-6 \-5 \-4 \-3 \-2 \-1 X=0 1 2 3 4 5 6 .Ve .PP There's no \f(CW\*(C`arms\*(C'\fR parameter for other \f(CW\*(C`realpart\*(C'\fR values as yet, only for i+1. Is there a good rotated arrangement for others? Do \*(L"norm\*(R" many copies fill the plane in general? .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::ComplexPlus\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::ComplexPlus\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::ComplexPlus->new ()" Create and return a new path object. .ie n .IP """($x,$y) = $path\->n_to_xy ($n)""" 4 .el .IP "\f(CW($x,$y) = $path\->n_to_xy ($n)\fR" 4 .IX Item "($x,$y) = $path->n_to_xy ($n)" Return the X,Y coordinates of point number \f(CW$n\fR on the path. Points begin at 0 and if \f(CW\*(C`$n < 0\*(C'\fR then the return is an empty list. .SS "Level Methods" .IX Subsection "Level Methods" .ie n .IP """($n_lo, $n_hi) = $path\->level_to_n_range($level)""" 4 .el .IP "\f(CW($n_lo, $n_hi) = $path\->level_to_n_range($level)\fR" 4 .IX Item "($n_lo, $n_hi) = $path->level_to_n_range($level)" Return \f(CW\*(C`(0, 2**$level \- 1)\*(C'\fR, or for 2 arms return \f(CW\*(C`(0, 2 * 2**$level \- 1)\*(C'\fR. With the \f(CW\*(C`realpart\*(C'\fR option return \f(CW\*(C`(0, $norm**$level \- 1)\*(C'\fR where norm=realpart^2+1. .SH "FORMULAS" .IX Header "FORMULAS" Various formulas and pictures etc for the i+1 case can be found in the author's long mathematical write-up (section \*(L"Complex Base i+1\*(R") .Sp .RS 4 .RE .SH "OEIS" .IX Header "OEIS" Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include .Sp .RS 4 (etc) .RE .PP .Vb 8 \& realpart=1 (i+1, the default) \& A290885 \-X \& A290884 Y \& A290886 norm X^2 + Y^2 \& A146559 dX at N=2^k\-1 (step to next replication level) \& A077950,A077870 \& location of ComplexMinus origin in ComplexPlus \& (mirror horizontal even level, vertical odd level) .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::ComplexMinus, Math::PlanePath::ComplexRevolving, Math::PlanePath::DragonCurve .Sp .RS 4 .RE .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde .PP This file is part of Math-PlanePath. .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .