Math::...h::Rows(3pm)
π Math::...h::Rows β points in fixed-width rows π
okay bestie, welcome to Math::PlanePath::Rows, straight outta the User Contributed Perl Documentation β¨ this one is genuinely one of the chillest path classes in the whole Math-PlanePath universe, and by the end of this page you're gonna be obsessed with it, no cap π«Ά
β¨ SYNOPSIS β¨
use Math::PlanePath::Rows;
my $path = Math::PlanePath::Rows->new (width => 20);
my ($x, $y) = $path->n_to_xy (123);
πΈ DESCRIPTION πΈ
so the whole vibe here is: it's rows of a given fixed width. that's it. that's the path. width=7 looks like this, and honestly it's giving grid energy π
width => 7
3 | 22 23 24 ...
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
π N Start
by default it numbers points starting at N=1, just like the diagram up there β¬οΈ but if you want, an optional "n_start" can give you a different start while keeping the exact same shape. for example, to start at 0:
n_start => 0, width => 7
3 | 21 22 23 24 ...
2 | 14 15 16 17 18 19 20
1 | 7 8 9 10 11 12 13
Y=0 | 0 1 2 3 4 5 6
-------------------------------
X=0 1 2 3 4 5 6
the only effect is to push the N values around by a constant amount, fr fr. it might help match coordinates with something else that's zero-based π
β¨ FUNCTIONS β¨
see "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes π
$path = Math::PlanePath::Rows->new (width => $w)$path = Math::PlanePath::Rows->new (width => $w, n_start => $n)
create and return a new path object π a "width" parameter must be supplied, okay? like, non-negotiable, bestie.
($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. cute, right? π¦
($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 π―
π SEE ALSO π
Math::PlanePath, Math::PlanePath::Columns
π HOME PAGE π
<http://user42.tuxfamily.org/math-planepath/index.html>
π LICENSE π
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/>.
and that's the whole page bestie!! π₯³ this was Math::...h::Rows(3pm), generated by perl v5.32.0 on 2021-01-23 β go read it, then go build some rows, you absolute icon π
β¨
π¦ where this page comes from
- debian bookworm: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- debian trixie: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu jammy: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu noble: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu resolute: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu stonking: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms