.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Math::PlanePath::ComplexPlus 3pm" .TH Math::PlanePath::ComplexPlus 3pm "2014-08-26" "perl v5.20.1" "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 with integer r>=1. The default is base i+1 which gives a shape similar to the \&\f(CW\*(C`DragonCurve\*(C'\fR, .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 .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 above N=0 to N=4, then N=5 to N=9, etc. 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 the 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 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 "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::ComplexMinus, Math::PlanePath::ComplexRevolving, Math::PlanePath::DragonCurve .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014 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 .