Math::PlanePath::Columns(3pm) | User Contributed Perl Documentation | Math::PlanePath::Columns(3pm) |
Math::PlanePath::Columns -- points in fixed-height columns
use Math::PlanePath::Columns; my $path = Math::PlanePath::Columns->new; my ($x, $y) = $path->n_to_xy (123);
This path is columns of a given fixed height. For example height 5 would be
| 4 | 5 10 15 20 <--- height==5 3 | 4 9 14 19 2 | 3 8 13 18 1 | 2 7 12 17 ... Y=0 | 1 6 11 16 21 ---------------------- X=0 1 2 3 4 ...
The default is to number points starting N=1 as shown above. An optional "n_start" can give a different start, with the same shape. For example to start at 0,
n_start => 0, height => 5 4 | 4 9 14 19 3 | 3 8 13 18 2 | 2 7 12 17 1 | 1 6 11 16 ... Y=0 | 0 5 10 15 20 ---------------------- X=0 1 2 3 4 ...
The only effect is to push the N values around by a constant amount. It might help match coordinates with something else zero-based.
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
$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 rectangle $x >= -0.5 and -0.5 <= y < height+0.5 is covered.
Math::PlanePath, Math::PlanePath::Rows, Math::PlanePath::CoprimeColumns
<http://user42.tuxfamily.org/math-planepath/index.html>
Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 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/>.
2021-01-23 | perl v5.32.0 |