The perfect squares 1,4,9,16 fall one before the bottom left corner of each loop, and the pronic numbers 2,6,12,20,30,etc are the vertical upwards from X=1,Y=0.

Square Spiral

This spiral goes around at the same rate as the SquareSpiral. It's as if two corners are cut off (like the DiamondSpiral) and two others extended (like the OctagramSpiral). The net effect is the same looping rate but the points pushed around a bit.

Taking points up to a perfect square shows the similarity. The two triangular cut-off corners marked by "."s are matched by the two triangular extensions.

Return the point number for coordinates $x,$y. $x and $y are each rounded to the nearest integer, which has the effect of treating each N in the path as centred in a square of side 1, so the entire plane is covered.

In the two permutations the pyramid spiral is conceived as starting to the left and the square spiral starting upwards. The paths here start in the same direction (both to the right), hence rotate 90 to adjust the orientation.

HOME PAGE

LICENSE

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

Module Install Instructions

To install Math::PlanePath::PyramidSpiral, simply copy and paste either of the commands in to your terminal