.\" 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::QuintetCentres 3pm" .TH Math::PlanePath::QuintetCentres 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::QuintetCentres \-\- self\-similar "plus" shape centres .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::QuintetCentres; \& my $path = Math::PlanePath::QuintetCentres\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This a self-similar curve tracing out a \*(L"+\*(R" shape like the \f(CW\*(C`QuintetCurve\*(C'\fR but taking the centre of each square visited by that curve. .PP .Vb 10 \& 92 12 \& / | \& 124\-... 93 91\-\-90 88 11 \& | \e \e / \e \& 122\-123 120 102 94 82 89 86\-\-87 10 \& \e / | / | / / | | \& 121 119 103 101\-100 95 81 83\-\-84\-\-85 9 \& \e \e \e \e \e \& 114\-115\-116 118 104 32 99\-\-98 96 80 78 8 \& | |/ / / | |/ |/ \e \& 112\-113 110 117 105 31 33\-\-34 97 36 79 76\-\-77 7 \& \e / \e \e \e \e / \e | \& 111 109\-108 106 30 42 35 38\-\-37 75 6 \& |/ / / | | / \& 107 29 43 41\-\-40\-\-39 74 5 \& \e \e | \& 24\-\-25\-\-26 28 44 46 72\-\-73 70 68 4 \& | |/ |/ \e \e / \e / \e \& 22\-\-23 20 27 18 45 48\-\-47 71 56 69 66\-\-67 3 \& \e / \e / \e | / \e | \& 21 6 19 16\-\-17 49 54\-\-55 58\-\-57 65 2 \& / \e | | \e | / \& 4\-\- 5 8\-\- 7 15 50\-\-51 53 59 64 1 \& \e | / |/ | \e \& 0\-\- 1 3 9 14 52 60\-\-61 63 <\- Y=0 \& |/ | \e |/ \& 2 10\-\-11 13 62 \-1 \& |/ \& 12 \-2 \& \& ^ \& \-1 X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 .Ve .PP The base figure is the initial the initial N=0 to N=4. It fills a \*(L"+\*(R" shape as .PP .Vb 10 \& ..... \& . . \& . 4 . \& . \e. \& ........\e.... \& . . .\e . \& . 0\-\-\-1 . 3 . \& . . | ./ . \& ......|./.... \& . |/. \& . 2 . \& . . \& ..... .Ve .SS "Arms" .IX Subsection "Arms" The optional \f(CW\*(C`arms\*(C'\fR parameter can give up to four copies of the curve, each advancing successively. For example \f(CW\*(C`arms=>4\*(C'\fR is as follows. Notice the N=4*k points are the plain curve, and N=4*k+1, N=4*k+2 and N=4*k+3 are rotated copies of it. .PP .Vb 10 \& 69 ... 7 \& / | \e \& 121 113 73 65\-\-61 53 120 6 \& / \e / \e \e \e / \e / \& ... 117 105\-109 77 29 57 45\-\-49 116 5 \& | / / | | \e \& 101 81 25 33\-\-37\-\-41 96\-100\-104 112 4 \& | \e \e | |/ \& 50 97\-\-93 85 21 13 88\-\-92 80 108 72 3 \& / | |/ |/ \e \e / \e / \e \& 54 46\-\-42 89 10 17 5\-\- 9 84 24 76 64\-\-68 2 \& \e | / | | / \e | \& 58 38 14 6\-\- 2 1 16\-\-20 32\-\-28 60 1 \& / | \e \e | / \& 62 30\-\-34 22\-\-18 3 0\-\- 4 12 36 56 <\- Y=0 \& | \e / | |/ | \e \& 70\-\-66 78 26 86 11\-\- 7 19 8 91 40\-\-44 52 \-1 \& \e / \e / \e \e / | / | |/ \& 74 110 82 94\-\-90 15 23 87 95\-\-99 48 \-2 \& / | | \e \e | \& 114 106\-102\-\-98 43\-\-39\-\-35 27 83 103 \-3 \& \e | |/ / | \& 118 51\-\-47 59 31 79 111\-107 119 ... \-4 \& / \e / \e \e \e / \e / \& 122 55 63\-\-67 75 115 123 \-5 \& \e |/ \& ... 71 \-6 \& \& ^ \& \-7 \-6 \-5 \-4 \-3 \-2 \-1 X=0 1 2 3 4 5 6 .Ve .PP The pattern an ever expanding \*(L"+\*(R" shape with first cell N=0 at the origin. The further parts are effectively as follows, .PP .Vb 10 \& +\-\-\-+ \& | | \& +\-\-\-+\-\-\- +\-\-\-+ \& | | | \& +\-\-\-+ +\-\-\-+ +\-\-\-+ \& | 2 | 1 | | \& +\-\-\-+ +\-\-\-+\-\-\-+ +\-\-\-+ \& | | 3 | 0 | \& +\-\-\-+ +\-\-\-+ +\-\-\-+ \& | | | \& +\-\-\-+ +\-\-\-+\-\-\-+ \& | | \& +\-\-\-+ .Ve .PP At higher replication levels the sides become wiggly and spiralling, but they're symmetric and mesh to fill the plane. .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::QuintetCentres\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::QuintetCentres\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::QuintetCentres->new ()" .PD 0 .ie n .IP """$path = Math::PlanePath::QuintetCentres\->new (arms => $a)""" 4 .el .IP "\f(CW$path = Math::PlanePath::QuintetCentres\->new (arms => $a)\fR" 4 .IX Item "$path = Math::PlanePath::QuintetCentres->new (arms => $a)" .PD 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. .Sp Fractional positions give an X,Y position along a straight line between the integer positions. .ie n .IP """$n = $path\->n_start()""" 4 .el .IP "\f(CW$n = $path\->n_start()\fR" 4 .IX Item "$n = $path->n_start()" Return 0, the first N in the path. .ie n .IP """($n_lo, $n_hi) = $path\->rect_to_n_range ($x1,$y1, $x2,$y2)""" 4 .el .IP "\f(CW($n_lo, $n_hi) = $path\->rect_to_n_range ($x1,$y1, $x2,$y2)\fR" 4 .IX Item "($n_lo, $n_hi) = $path->rect_to_n_range ($x1,$y1, $x2,$y2)" In the current code the returned range is exact, meaning \f(CW$n_lo\fR and \&\f(CW$n_hi\fR are the smallest and biggest in the rectangle, but don't rely on that yet since finding the exact range is a touch on the slow side. (The advantage of which though is that it helps avoid very big ranges from a simple over-estimate.) .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, 5**$level \- 1)\*(C'\fR, or for multiple arms return \f(CW\*(C`(0, $arms * 5**$level \- 1)\*(C'\fR. .Sp There are 5^level points in a level, or arms*5^level for multiple arms, numbered starting from 0. .SH "FORMULAS" .IX Header "FORMULAS" .SS "X,Y to N" .IX Subsection "X,Y to N" The \f(CW\*(C`xy_to_n()\*(C'\fR calculation is similar to the \f(CW\*(C`FlowsnakeCentres\*(C'\fR. For a given X,Y a modulo 5 remainder is formed .PP .Vb 1 \& m = (2*X + Y) mod 5 .Ve .PP This distinguishes the five squares making up the base figure. For example in the base N=0 to N=4 part the m values are .PP .Vb 8 \& +\-\-\-\-\-+ \& | m=3 | 1 \& +\-\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-+ \& | m=0 | m=2 | m=4 | <\- Y=0 \& +\-\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-+ \& | m=1 | \-1 \& +\-\-\-\-\-+ \& X=0 1 2 .Ve .PP From this remainder X,Y can be shifted down to the 0 position. That position corresponds to a vector multiple of X=2,Y=1 and 90\-degree rotated forms of that vector. That vector can be divided out and X,Y shrunk with .PP .Vb 2 \& Xshrunk = (Y + 2*X) / 5 \& Yshrunk = (2*Y \- X) / 5 .Ve .PP If X,Y are considered a complex integer X+iY the effect is a remainder modulo 2+i, subtract that to give a multiple of 2+i, then divide by 2+i. The vector X=2,Y=1 or 2+i is because that's the N=5 position after the base shape. .PP The remainders can then be mapped to base 5 digits of N going from high to low and making suitable rotations for the sub-part orientation of the curve. The remainders alone give a traversal in the style of \f(CW\*(C`QuintetReplicate\*(C'\fR. Applying suitable rotations produces the connected path of \&\f(CW\*(C`QuintetCentres\*(C'\fR. .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 1 \& A099456 level Y end, being Im((2+i)^k) \& \& arms=2 \& A139011 level Y end, being Re((2+i)^k) .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::QuintetCurve, Math::PlanePath::QuintetReplicate, Math::PlanePath::FlowsnakeCentres .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 .