NAME

Math::PlanePath::StaircaseAlternating -- stair-step diagonals up and down

SYNOPSIS

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

DESCRIPTION

This path makes a staircase pattern up from Y axis down to the X and then back up again.

10       46
          |
 9       47--48
              |
 8       45  49--50
          |       |
 7       44--43  51--52
              |       |
 6       16  42--41  53--54
          |       |       |
 5       17--18  40--39  55--...
              |       |
 4       15  19--20  38--37
          |       |       |
 3       14--13  21--22  36--35
              |       |       |
 2        2  12--11  23--24  34--33
          |       |       |       |
 1        3-- 4  10-- 9  25--26  32--31
              |       |       |       |
Y=0 ->    1   5-- 6   8-- 7  27--28  30--29

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

FUNCTIONS

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

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

Create and return a new staircase path object.

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

Return the X,Y coordinates of point number $n on the path.

SEE ALSO

Math::PlanePath, Math::PlanePath::Staircase, Math::PlanePath::DiagonalsAlternating

HOME PAGE

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

LICENSE

Copyright 2011 Kevin Ryde

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/>.