Math::PlanePath::Rows -- points in fixed-width rows
use Math::PlanePath::Rows; my $path = Math::PlanePath::Rows->new (width => 20); my ($x, $y) = $path->n_to_xy (123);
This path is rows of a given fixed width. For example width 7 is
width=7 ^ ... | 3 | 22 ... 2 | 15 16 17 18 19 20 21 1 | 8 9 10 11 12 13 14 y=0 | 1 2 3 4 5 6 7 ------------------------------- x=0 1 2 3 4 5 6
See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes.
$path = Math::PlanePath::Rows->new (width => $w)
Create and return a new path object. A
widthparameter must be supplied.
($x,$y) = $path->n_to_xy ($n)
Return the X,Y coordinates of point number
$nin the path.
$n = $path->xy_to_n ($x,$y)
Return the point number for coordinates
$yare rounded to the nearest integers, which has the effect of treating each point in the path as a square of side 1, so a column -0.5 <= x < width+0.5 and y>=-0.5 is covered.
Copyright 2010, 2011 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/>.