Math::...eander(3pm)

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

πŸ¦‹ NAME πŸ¦‹

okay so bestie, welcome to Math::...eander(3pm) β€” that's the manual page, and it lives in the User Contributed Perl Documentation section. the actual thing it's documenting is Math::PlanePath::WunderlichMeander, which is a 3x3 self-similar "R" shape. that's it, that's the whole vibe check. πŸ’–


✨ SYNOPSIS ✨

use Math::PlanePath::WunderlichMeander;
my $path = Math::PlanePath::WunderlichMeander->new;
my ($x, $y) = $path->n_to_xy (123);

four lines and you're already plotting, no cap. 🫢


🌸 DESCRIPTION 🌸

so this is an integer version of the 3x3 self-similar meander from

Walter Wunderlich, "Uber Peano-Kurven", Elemente der Mathematik,
volume 28, number 1, 1973, pages 1-10.
<http://sodwana.uni-ak.ac.at/geom/mitarbeiter/wallner/wunderlich/>,
<http://sodwana.uni-ak.ac.at/geom/mitarbeiter/wallner/wunderlich/pdf/125.pdf>

and here's what it actually looks like, grid and all:

     8     20--21--22  29--30--31  38--39--40
            |       |   |       |   |       |
     7     19  24--23  28  33--32  37  42--41
            |   |       |   |       |   |
     6     18  25--26--27  34--35--36  43--44
            |                               |
     5     17  14--13  56--55--54--53--52  45
            |   |   |   |               |   |
     4     16--15  12  57  60--61  50--51  46
                    |   |   |   |   |       |
     3      9--10--11  58--59  62  49--48--47
            |                   |
     2      8   5-- 4  65--64--63  74--75--76
            |   |   |   |           |       |
     1      7-- 6   3  66  69--70  73  78--77
                    |   |   |   |   |   |
   Y=0->    0-- 1-- 2  67--68  71--72  79--80-...

           X=0  1   2   3   4   5   6   7   8

ok so the tea β˜•: the base pattern is the N=0 to N=8 section. it works as a traversal of a 3x3 square, starting in one corner and going along one side. the base figure goes upwards, and then it's used rotated by 180 degrees and/or transposed to go in other directions β€” like so:

   +----------------+----------------+---------------+
   | ^              |              * | ^             |
   | |              |  rotate 180  | | |   base      |
   | |     8        |       5      | | |     4       |
   | |   base       |              | | |             |
   | *              |              v | *             |
   +----------------+----------------+---------------+
   | <------------* | <------------* | ^             |
   |                |                | |             |
   |       7        |       6        | |     3       |
   |   rotate 180   |   rotate 180   | |   base      |
   |  + transpose   |  + transpose   | *             |
   +----------------+----------------+---------------+
   |                |                | ^             |
   |                |                | |             |
   |       0        |       1        | |     2       |
   |   transpose    |   transpose    | |   base      |
   | *----------->  | *------------> | *             |
   +----------------+----------------+---------------+

the base 0 to 8 goes upwards, so the across sub-parts are an X,Y transpose. and because the transpose happens in the 0 part, the higher levels go alternately up or across. so like: N=0 to N=8 goes up, then the next level N=0,9,18,.,72 goes right, then N=81,162,..,648 goes up again, etc. it's giving ✨oscillation✨.

Wunderlich's conception is successive lower levels of detail as a space-filling curve. the transposing in that case applies to ever smaller parts. but for the integer version here, the start direction is held fixed and the successively higher levels alternate. the first move N=0 to N=1 is rightwards per the "Schema" shown in Wunderlich's paper (and like various other "PlanePath" curves). iykyk. πŸ’…


πŸ’œ FUNCTIONS πŸ’œ

see "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes. that's the shared lore, bestie.

  • $path = Math::PlanePath::WunderlichMeander->new () β€” makes you a brand new path object and hands it right over. iconic.
  • ($x,$y) = $path->n_to_xy ($n) β€” gives you back the X,Y coordinates of point number $n on the path. points start at 0, and if $n < 0 then the return is an empty list. so negative N is a no-go, we don't do that here. πŸ™ˆ
  • ($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 approximating, no vibes-based guessing, fr fr.

πŸŽ€ Level Methods πŸŽ€

  • ($n_lo, $n_hi) = $path->level_to_n_range($level) β€” returns (0, 9**$level - 1). that's the whole thing. 9 to the power of level, minus one. slay. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

  • Math::PlanePath
  • Math::PlanePath::PeanoCurve

go read those too, they're the sibling energy. πŸ¦‹


🌈 HOME PAGE 🌈

<http://user42.tuxfamily.org/math-planepath/index.html>


⭐ LICENSE ⭐

Copyright 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 yes bestie, that means you gotta ship the license with it. it's the rules. πŸ’€

ok that's the whole page!! πŸŽ€ this one's from perl v5.32.0, dated 2021-01-23, and it's the Math::...eander(3pm) manual β€” and honestly? iconic of it. go fill some planes, bestie. πŸ’–βœ¨πŸ¦‹