NAME

Math::PlanePath::MathImageSquareArms -- four spiral arms

SYNOPSIS

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

DESCRIPTION

In progress ...

This path follows four spiral arms, each advancing successively,

                             --33--29
                                    |
               26--22--18--14--10  25
                |               |   |
               30  11-- 7-- 3   6  21
                |   |           |   |
                   15   4   1   2  17
                    |   |   |       |   |
                   19   8   5-- 9--13  32
                    |   |               |
                   23  12--16--20--24--28
                    |
                   27--31--

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

The X,Y points are integers using every second position to give a triangular lattice, per "Triangular Lattice" in Math::PlanePath.

Each arm is N=6*k+rem for a remainder rem=0,1,2,3,4,5, so sequences related to multiples of 6 or with a modulo 6 pattern may fall on particular arms.

FUNCTIONS

$path = Math::PlanePath::MathImageSquareArms->new ()

Create and return a new square spiral object.

($x,$y) = $path->n_to_xy ($n)

Return the X,Y coordinates of point number $n on the path. For $n < 1 the return is an empty list, as the path starts at 1.

Fractional $n gives a point on the line between $n and $n+4, that $n+4 being the next on the same spiralling arm. This is probably of limited use, but arises fairly naturally from the calculation.

SEE ALSO

Math::PlanePath, Math::PlanePath::MathImageSquareSpiral