NAME
Math::PlanePath::WunderlichMeander  3x3 selfsimilar "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 selfsimilar meander from
Walter Wunderlich, "Uber PeanoKurven", Elemente der Mathematik, volume 28, number 1, 1973, pages 110. http://sodwana.uniak.ac.at/geom/mitarbeiter/wallner/wunderlich/, http://sodwana.uniak.ac.at/geom/mitarbeiter/wallner/wunderlich/pdf/125.pdf
8 202122 293031 383940
     
7 19 2423 28 3332 37 4241
     
6 18 252627 343536 4344
 
5 17 1413 5655545352 45
     
4 1615 12 57 6061 5051 46
     
3 91011 5859 62 494847
 
2 8 5 4 656463 747576
     
1 7 6 3 66 6970 73 7877
     
Y=0> 0 1 2 6768 7172 7980...
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 subparts 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 spacefilling 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
SEE ALSO
Math::PlanePath, Math::PlanePath::PeanoCurve
HOME PAGE
http://user42.tuxfamily.org/mathplanepath/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde
This file is part of MathPlanePath.
MathPlanePath 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.
MathPlanePath 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 MathPlanePath. If not, see <http://www.gnu.org/licenses/>.