Math::...olumns(3pm)
π Math::...olumns β User Contributed Perl Documentation π
okay bestie, sit down, hydrate, because we're talking about Math::PlanePath::Columns β points in fixed-height columns π. That's the whole vibe. It lives in the User Contributed Perl Documentation section of your man pages, and honestly? she's a queen. π
β¨ NAME β¨
Math::PlanePath::Columns β points in fixed-height columns π¦
πΈ SYNOPSIS πΈ
use Math::PlanePath::Columns;
my $path = Math::PlanePath::Columns->new;
my ($x, $y) = $path->n_to_xy (123);
like. that's it. that's the whole thing. she's simple, she's clean, she serves. β¨
π DESCRIPTION π
okay so this path is columns of a given fixed height. Fixed. Height. You pick a height, she stacks points up in columns that tall, and then she moves on to the next column. no cap.
so say height is 5, right? it's giving:
|
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 ...
see how each column just goes up 1, 2, 3, 4, 5 and then the next column starts over? that's the whole personality. π
π N Start π
default is to number points starting N=1, like in the little picture up there βοΈ. but there's an optional n_start if you want a different start β same shape, just different numbers. periodt.
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 ...
and the only effect of this is that it pushes the N values around by a constant amount. that's it. that's the tea β. it might help you match coordinates with something else that's zero-based, iykyk. π
π FUNCTIONS π
heads up bestie β for behaviour common to all the path classes, go read "FUNCTIONS" in Math::PlanePath. this page only covers her own specifics. π«Ά
$path = Math::PlanePath::Columns->new (height => $h)$path = Math::PlanePath::Columns->new (height => $h, n_start => $n)
Create and return a new path object. and listen β a height parameter must be supplied. like, non-negotiable. she needs to know how tall her columns are, okay?? π
($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.
okay important detail: $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. π¦
($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. no approximation, no guessing, she ate. π₯
π₯ SEE ALSO π₯
Math::PlanePathMath::PlanePath::RowsMath::PlanePath::CoprimeColumns
the friend group π go say hi.
π HOME PAGE π
<http://user42.tuxfamily.org/math-planepath/index.html> β go visit, she'd love that for you π
π 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/>.
bestie the ALL-CAPS warranty bits are NOT a joke, they're the legal realness. read them, respect them, don't come for me. π
and that's the page!! this was documented with perl v5.32.0, dated 2021-01-23, and honestly she's been serving since day one πβ¨ mwah, go forth and plot some columns πππ¦
π¦ 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