NAME
Math::PlanePath::Rows -- points in fixed-width rows
SYNOPSIS
use Math::PlanePath::Rows;
my $path = Math::PlanePath::Rows->new (width => 20);
my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION
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
FUNCTIONS
$path = Math::PlanePath::Rows->new (width => $w)
-
Create and return a new path object. A
width
parameter must be supplied. ($x,$y) = $path->n_to_xy ($n)
-
Return the x,y coordinates of point number
$n
in the path. $n = $path->xy_to_n ($x,$y)
-
Return the point number for coordinates
$x,$y
.$x
and$y
are 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.
SEE ALSO
Math::PlanePath, Math::PlanePath::Columns
HOME PAGE
http://user42.tuxfamily.org/math-planepath/index.html
LICENSE
Math-PlanePath is Copyright 2010 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/>.