Scroll to navigation

Math::PlanePath::WunderlichMeander(3pm) User Contributed Perl Documentation Math::PlanePath::WunderlichMeander(3pm)

NAME

Math::PlanePath::WunderlichMeander -- 3x3 self-similar "R" shape

SYNOPSIS

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

DESCRIPTION

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>

      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

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 it's then used rotated by 180 degrees and/or transposed to go in other directions,

    +----------------+----------------+---------------+
    | ^              |              * | ^             |
    | |              |  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. The transpose in the 0 part means the higher levels go alternately up or across. So N=0 to N=8 goes up, then the next level N=0,9,18,.,72 goes right, then N=81,162,..,648 up again, etc.

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).

FUNCTIONS

See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.

"$path = Math::PlanePath::WunderlichMeander->new ()"
Create and return a new path object.
"($x,$y) = $path->n_to_xy ($n)"
Return the X,Y coordinates of point number $n on the path. Points begin at 0 and if "$n < 0" then the return is an empty list.
"($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.

Level Methods

"($n_lo, $n_hi) = $path->level_to_n_range($level)"
Return "(0, 9**$level - 1)".

SEE ALSO

Math::PlanePath, Math::PlanePath::PeanoCurve

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/>.

2021-01-23 perl v5.32.0