NAME
Math::PlanePath::KochelCurve  3x3 selfsimilar R and F
SYNOPSIS
use Math::PlanePath::KochelCurve;
my $path = Math::PlanePath::KochelCurve>new;
my ($x, $y) = $path>n_to_xy (123);
DESCRIPTION
This is an integer version of the Kochel curve by Herman Haverkort. It fills the first quadrant in a 3x3 selfsimilar pattern made from two base shapes.

8 8079 72717069 605958
    
7 7778 73 666768 61 5657
    
6 767574 65646362 5554

5 1112 17181920 4748 53
      
4 10 13 16 2524 21 46 49 52
        
3 9 1415 26 2322 45 5051
  
2 8 7 6 272829 444342
  
1 1 2 5 323130 3738 41
      
Y=0> 0 3 4 33343536 3940
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
The base shapes are an "R" and an "F". The R goes along an edge, the F goes diagonally across.
R pattern F pattern ^
++++ ++++
2  3\ 4  2  3\ 8 
 R   F  R   R   F  R 
   \     \  
++++ ++++
1 / 6 5 /  1 / 4 / 7 / 
 F  Rrev F   F  F  F 
 /  /   /  /  / 
++++ ++++
0 7\ 8  0 5\ 6 
 Rrev F  R   Rrev F Rrev
 o  \ >  o  \  
++++ ++++
"Rrev" means the R pattern followed in reverse, which is
++++
8<7\ 6  Rrev pattern
 R  F  Rrev
  \  turned 90 degrees
++++ so as to start at
1 / 2 5 /  bottom left
 F  R  F 
 /   / 
++++
0 3\ 4 
 Rrev F Rrev
 o  \  
++++
The F pattern is symmetric, the same forward or reverse, including its subparts taken in reverse, so there's no separate "Frev" pattern.
The initial N=0 to N=8 is the Rrev turned 90, then N=9 to N=17 is the F shape. The next higher level N=0,N=9,N=18 to N=72 is the Rrev too, as is any N=9^k to N=8*9^k.
Fractal
The curve is conceived by Haverkort for filling a unit square by descending into eversmaller replacements, like other spacefilling curves. For that the toplevel can be any of the patterns. To descend any of the shapes can be used for the start, but for the outward expanding version here the starting pattern must occur at the start of its next higher level, which means Rrev is the only choice as it's the only start in any of the three patterns.
But all the patterns can be found in the path at any desired size. For example the "1" part of Rrev is an F, which means F to a desired level can be found at
NFstart = 1 * 9^level
NFlast = NFstart + 9^level  1
= 2 * 9^level  1
XFstart = 3^level
YFstart = 0
level=3 for N=729 to N=1457 is a 27x27 which is the levelthree F shown in Haverkort's paper, starting at XFstart=27,YFstart=0.
FUNCTIONS
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
$path = Math::PlanePath::KochelCurve>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.
Level Methods
SEE ALSO
Math::PlanePath, Math::PlanePath::PeanoCurve, Math::PlanePath::WunderlichMeander
Herman Haverkort, "Recursive Tilings and SpaceFilling Curves with Little Fragmentation", Journal of Computational Geometry, 2(1), 92127, 2011.
http://jocg.org/index.php/jocg/article/view/68 http://jocg.org/index.php/jocg/article/download/68/20 http://arxiv.org/abs/1002.1843
http://alexandria.tue.nl/openaccess/Metis239505.pdf (slides) http://www.win.tue.nl/~hermanh/stack/hrtslfeurocg2010talk.pdf (short form)
HOME PAGE
http://user42.tuxfamily.org/mathplanepath/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014, 2015, 2016 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/>.