SYNOPSIS
use Math::PlanePath::DiamondArms;
my $path = Math::PlanePath::DiamondArms>new;
my ($x, $y) = $path>n_to_xy (123);
DESCRIPTION
This path follows four spiral arms, each advancing successively in a diamond pattern,
25 ... 4 29 14 21 36 3 33 18 7 10 17 32 2 ... 22 11 4 3 6 13 28 1 26 15 8 1 2 9 24 ... < Y=0 30 19 12 5 20 35 1 34 23 16 31 2 ... 27 3 ^ 3 2 1 X=0 1 2 3 4
Each arm makes a spiral widening out by 4 each time around, thus leaving room for four such arms. Each arm loop is 64 longer than the preceding loop. For example N=13 to N=85 below is 8413=72 points, and the next loop N=85 to N=221 is 22185=136 which is an extra 64, ie. 72+64=136.
25 ... / \ \ 29 . 21 . . . 93 / \ \ 33 . . . 17 . . . 89 / \ \ 37 . . . . . 13 . . . 85 / / / 41 . . . 1 . 9 . . . 81 \ \ / / 45 . . . 5 . . . 77 \ / 49 . . . . . 73 \ / 53 . . . 69 \ / 57 . 65 \ / 61
Each arm is N=4*k+rem for a remainder rem=0,1,2,3, so sequences related to multiples of 4 or with a modulo 4 pattern may fall on particular arms.
The starts of each arm N=1,2,3,4 are at X=0 or 1 and Y=0 or 1,
.. \ 4 3 .. Y=1 / / .. 1 2 < Y=0 \ .. ^ ^ X=0 X=1
They could be centred around the origin by taking X1/2,Y1/2 so for example N=1 would be at 1/2,1/2. But the it's done as N=1 at 0,0 to stay in integers.
FUNCTIONS
See ``FUNCTIONS'' in Math::PlanePath for behaviour common to all path classes. "$path = Math::PlanePath::DiamondArms>new ()"
 Create and return a new path 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 point on the same spiralling arm. This is probably of limited use, but arises fairly naturally from the calculation.
Descriptive Methods
 "$arms = $path>arms_count()"
 Return 4.
LICENSE
Copyright 2011, 2012, 2013, 2014, 2015, 2016 Kevin RydeThis file is part of MathPlanePath.
MathPlanePath 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.
MathPlanePath 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 MathPlanePath. If not, see <http://www.gnu.org/licenses/>.