Math::...olumns(3pm)

πŸ“¦
version 129 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… 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::PlanePath
  • Math::PlanePath::Rows
  • Math::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 πŸŽ€πŸ’–πŸ¦‹