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 width parameter must be supplied.
width
($x,$y) = $path->n_to_xy ($n)
Return the X,Y coordinates of point number $n in the path.
$n
$n = $path->xy_to_n ($x,$y)
Return the point number for coordinates $x,$y.
$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.
$x
$y
($n_lo, $n_hi) = $path->rect_to_n_range ($x1,$y1, $x2,$y2)
The returned range is exact, meaning $n_lo and $n_hi are the smallest and biggest in the rectangle.
$n_lo
$n_hi
Math::PlanePath, Math::PlanePath::Columns
http://user42.tuxfamily.org/math-planepath/index.html
Copyright 2010, 2011, 2012 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/>.
To install Math::PlanePath, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::PlanePath
CPAN shell
perl -MCPAN -e shell install Math::PlanePath
For more information on module installation, please visit the detailed CPAN module installation guide.