Provided by: libmath-planepath-perl_113-1_all bug

NAME

       Math::PlanePath::QuadricIslands -- quadric curve rings

SYNOPSIS

        use Math::PlanePath::QuadricIslands;
        my $path = Math::PlanePath::QuadricIslands->new;
        my ($x, $y) = $path->n_to_xy (123);

DESCRIPTION

       This is concentric islands made from four sides of the "QuadricCurve",

                                         27--26                     3
                                          |   |
                                     29--28  25  22--21             2
                                      |       |   |   |
                                     30--31  24--23  20--19         1
                                          | 4--3          |
                                 34--33--32    | 16--17--18     <- Y=0
                                  |         1--2  |
                                 35--36   7---8  15--14            -1
                                          |   |       |
                                      5---6   9  12--13            -2
                                              |   |
                                 55--56      10--11                -3
                                  |   |
             ...             53--54  57  60--61                    -4
                              |       |   |   |
                             52--51  58--59  62--63                -5
                                  |               |
                         48--49--50      66--65--64                -6
                          |               |
                 39--40  47--46          67--68                    -7
                  |   |       |               |
             37--38  41  44--45              69                    -8
                      |   |                   |
                     42--43                  70--71                -9
                                                  |
                                         74--73--72               -10
                                          |
                                         75--76  79--80      ...  -11
                                              |   |   |       |
                                             77--78  81  84--85   -12
                                                      |   |
                                                     82--83       -13

                                              ^
             -8  -7  -6  -5  -4  -3  -2  -1  X=0  1   2   3   4

       The initial figure is the square N=1,2,3,4 then for the next level each straight side
       expands to 4x longer and a zigzag like N=5 through N=13 and the further sides to N=36.

                                       *---*
                                       |   |
             *---*     becomes     *---*   *   *---*
                                           |   |
                                           *---*

   Level Ranges
       Counting the innermost square as level 0, each ring is

           length = 4 * 8^level     many points
           Nstart = 1 + length[0] + ... + length[level-1]
                  = (4*8^level + 3)/7
           Xstart = - 4^level / 2
           Ystart = - 4^level / 2

       For example the lower partial ring shown above is level 2 starting N=(4*8^2+3)/7=37 at
       X=-(4^2)/2=-8,Y=-8.

       The innermost square N=1,2,3,4 is on 0.5 coordinates, for example N=1 at X=-0.5,Y=-0.5.
       This is centred on the origin and consistent with the (4^level)/2.  Points from N=5
       onwards are integer X,Y.

              4-------3    Y=+1/2
              |       |
              |   o   |
                      |
              1-------2    Y=-1/2

           X=-1/2   X=+1/2

FUNCTIONS

       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.

       "$path = Math::PlanePath::QuadricIslands->new ()"
           Create and return a new path object.

SEE ALSO

       Math::PlanePath, Math::PlanePath::QuadricCurve, Math::PlanePath::KochSnowflakes,
       Math::PlanePath::GosperIslands

HOME PAGE

       <http://user42.tuxfamily.org/math-planepath/index.html>

LICENSE

       Copyright 2011, 2012, 2013 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/>.