/***********************************************************************
ifs-classics v1.01 (31 March 2020)

Copyright 2020 Herman Johannes Haverkort

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This file is part of the pftrail package. 
The package includes the following files:

* pftrail.cpp
* ifs-classics
* ifs-inventions
* generate-preamble.cpp
* colours
* postamble
* manual.pdf

New versions of the package may be available from 
http://spacefillingcurves.net or http://herman.haverkort.net.

************************************************************************

Curves/traversals in this file:

Face-continuous 2x2 square-filling curves:
* hilbert
* moore
* beta-omega (alias: beta-omega(omega))
* beta-omega(beta)
* beta-omega(closed)
* arrww

Other square- and rectangle-filling curves:
* peano 
* balanced-peano
* half-coil
* coil
* meurthe
* kochel
* meander (alias: r, r-curve)
* dekking

Discontinuous (4 parts') square-filling traversals
* z (aliases: z-order, morton, lebesgue)
* u (alias: u-order)
* u-with-L-jumps
* gray
* double-gray
* inside-out

Silver-rectangle (2 parts') variants of the above
* silver-z
* silver-gray
* silver-double-gray
* silver-inside-out

Face-continuous triangle-filling curves
* polya (and view: polya-f(1/3))
* polya-trapezoid
* polya-30-60-90
* tri-polya
* pinwheel

Discontinuous triangle-filling curves
* burstedde-holke
* hill-z

Fractal-filling curves
* harter-heighway-dragon
* rauzy-triangle
* terdragon
* fractal-pinwheel
* gosper (and view: gosper-f(2/7))
* inner-flip-gosper (and view: gosper-f(2/7))
* ventrella-snowflake
* soft-snowflake

******************************************************/

/******************************************************
Many traversals in this file come with a specific 
view/rendering configuration. To ignore this and use 
the default view/rendering configuration instead, use 
"-c :default" to use the default view:
******************************************************/

view default

/******************************************************
Hilbert's curve

   Re-encoded from:

   D. Hilbert:
   Über die stetige Abbildung einer Linie auf ein Flächenstück.
   Math. Ann. 38(3):459–460, 1891.   
******************************************************/

IFS hilbert

Square grid
4 segments

segment values:
1: 0, 1, 1,-1
2: 1, 0, 1, 1
3: 1, 0, 1, 1
4: 0,-1, 1,-1

Azimuth -8
Altitude 30

/******************************************************
Moore's curve (closed variation of Hilbert's curve)

   Re-encoded from:

   E. H. Moore:
   On Certain Crinkly Curves.
   Transactions of the American Mathematical Society, 
   Vol. 1, No. 1. (Jan., 1900), pp. 72-90.
******************************************************/

IFS moore

Square grid
2 generators

generator A: // Loop
5 segments

segment values:
1: 0,-2, X   // sentinel initial tunnel (not rendered)
2: 0, 1, B, 1, 1
3: 0, 1, B, 1, 1
4: 0,-1, B, 1, 1
5: 0,-1, B, 1, 1

generator B: // Hilbert curve
4 segments

segment values:
1: 0, 1, B,-1,-1
2: 1, 0, B, 1, 1
3: 1, 0, B, 1, 1
4: 0,-1, B,-1,-1

Render 0,-1,1,1

/******************************************************
An Omega section of Wierum's Beta-Omega curve.

   Re-encoded from:

   J.-M. Wierum:
   Definition of a new circular space-filling curve: βΩ-indexing.
   Technical report TR-001-02, 
   Paderborn Center for Parallel Computing (PC2), 2002.
******************************************************/

IFS beta-omega
IFS beta-omega(omega)

Square grid
2 generators

generator A: // Omega
4 segments

segment values:
1: 2, 1, B,-1,-1
2: 1, 2, B,-1, 1
3: 1,-2, B, 1, 1
4: 2,-1, B, 1,-1

generator B: // Beta
4 segments

segment values:
1: 0, 3, A, 1, 1
2: 1, 2, B,-1, 1
3: 1,-2, B, 1, 1
4: 2,-1, B, 1,-1

Azimuth -8
Altitude 30

/******************************************************
A Beta section of Wierum's Beta-Omega curve
(single-rule definition)

   Re-encoded from:

   J.-M. Wierum:
   Definition of a new circular space-filling curve: βΩ-indexing.
   Technical report TR-001-02, 
   Paderborn Center for Parallel Computing (PC2), 2002.
******************************************************/

IFS beta-omega(beta)

Square grid
7 segments

// the first four segments consitute an "omega" section;
// together they fill one quarter of the complete curve

segment values:
1:-1, 2,-1,-1
2:-2, 1,-1, 1
3: 2, 1, 1, 1
4: 1, 2, 1,-1
5: 2, 4,-1, 1
6: 2,-4, 1, 1
7: 4,-2, 1,-1

altitude 30

/******************************************************
Wierum's Beta-Omega curve (closed version)

   Re-encoded from:

   J.-M. Wierum:
   Definition of a new circular space-filling curve: βΩ-indexing.
   Technical report TR-001-02, 
   Paderborn Center for Parallel Computing (PC2), 2002.
******************************************************/

IFS beta-omega(closed)

Square grid
3 generators

generator A: // Loop
5 segments

segment values:
1: 0, 1, X   // sentinel initial tunnel (not rendered)
2:-1, 2, B, 1, 1
3: 1, 2, B,-1, 1
4: 1,-2, B, 1, 1
5:-1,-2, B,-1, 1

generator B: // Beta
4 segments

segment values:
1: 0, 3, C, 1, 1
2: 1, 2, B,-1, 1
3: 1,-2, B, 1, 1
4: 2,-1, B, 1,-1

generator C: // Omega
4 segments

segment values:
1: 2, 1, B,-1,-1
2: 1, 2, B,-1, 1
3: 1,-2, B, 1, 1
4: 2,-1, B, 1,-1

render 0,1,1,1

/******************************************************
ARRWW-curve (Asano-Ranjan-Roos-Welzl-Widmayer)

   Re-encoded from:

   T. Asano, D. Ranjan, T. Roos, E. Welzl, and P. Widmayer:
   Space-filling curves and their use in the design of 
   geometric data structures. 
   Theoretical Computer Science, 181(1):3–15, 1997.
******************************************************/

IFS arrww

Square grid
4 generators

generator A:
4 segments

segment values:
1: 1, 0, D, 1, 1
2: 0, 1, B,-1,-1
3: 0, 1, C, 1, 1
4: 1, 0, B, 1,-1

generator B:
4 segments

segment values:
1: 0, 1, D, 1,-1
2: 1, 0, C,-1, 1
3: 1, 0, B, 1, 1
4: 0,-1, B, 1,-1

generator C:
4 segments

segment values:
1: 1, 1, A, 1,-1
2: 0, 1, B, 1, 1
3: 1,-1, A, 1, 1
4: 0,-1, B, 1,-1

generator D:
4 segments

segment values:
1: 1, 1, A, 1, 1
2: 0, 1, C, 1, 1
3: 1,-1, A, 1, 1
4: 0,-1, D,-1,-1

/******************************************************
Peano's curve

   Re-encoded from:

   G. Peano:
   Sur une courbe, qui remplit toute une aire plane. 
   Math. Ann., 36(1):157–160, 1890.
******************************************************/

IFS peano

Square grid
9 segments

segment values:
1: 1, 1, 1, 1
2: 1,-1, 1,-1
3: 1, 1, 1, 1
4:-1, 1, 1,-1
5:-1,-1, 1, 1
6:-1, 1, 1,-1
7: 1, 1, 1, 1
8: 1,-1, 1,-1
9: 1, 1, 1, 1

/******************************************************
Balanced Peano curve

   Re-encoded from:

   H. Haverkort and F. van Walderveen.
   Locality and bounding-box quality of two-dimensional 
   space-filling curves. 
   Computational Geometry, 43(2):131–147, 2010.
******************************************************/

IFS balanced-peano

Cubic grid
3 segments

segment values:
1: 1, 0, 0, 1,-1
2: 0, 1, 0, 1, 1
3: 1, 0, 0, 1,-1

/******************************************************
Half-coil curve

   Re-encoded from:

   U. von Luxburg:
   Lokalitätsmaße von Peanokurven. 
   Student project report, Universität Tübingen, 
   Wilhelm-Schickard-Institut für Informatik, 1998.
******************************************************/

IFS half-coil

Square grid
9 segments

segment values:
1: 1, 1, 1,-1
2: 1,-1, 1,-1
3: 1, 1, 1,-1
4:-1, 1, 1,-1
5:-1,-1, 1,-1
6:-1, 1, 1,-1
7: 1, 1, 1,-1
8: 1,-1, 1,-1
9: 1, 1, 1,-1

/******************************************************
Coil curve

   Re-encoded from:

   U. von Luxburg:
   Lokalitätsmaße von Peanokurven. 
   Student project report, Universität Tübingen, 
   Wilhelm-Schickard-Institut für Informatik, 1998.
******************************************************/

IFS coil

Square grid
9 segments

segment values:
1: 1, 1, 1,-1
2: 1,-1, 1, 1
3: 1, 1, 1,-1
4:-1, 1, 1, 1
5:-1,-1, 1,-1
6:-1, 1, 1, 1
7: 1, 1, 1,-1
8: 1,-1, 1, 1
9: 1, 1, 1,-1

/******************************************************
Haverkort and Van Walderveen's Meurthe curve

   Re-encoded from:

   H. Haverkort and F. van Walderveen.
   Locality and bounding-box quality of two-dimensional 
   space-filling curves. 
   Computational Geometry, 43(2):131–147, 2010.
******************************************************/

IFS meurthe

Square grid
9 segments

segment values:
1: 1, 1, 1,-1
2: 1,-1, 1, 1
3: 1, 1, 1, 1
4:-1, 1, 1, 1
5:-1,-1, 1,-1
6:-1, 1, 1,-1
7: 1, 1, 1,-1
8: 1,-1, 1, 1
9: 1, 1, 1, 1

/******************************************************
Haverkort's Kochel curve

   Re-encoded from:

   H. Haverkort:
   Recursive tilings and space-filling curves with 
   little fragmentation. 
   J. Computational Geometry, 2(1):92–127, 2011.
******************************************************/

IFS kochel

Square grid
2 generators

generator A:
9 segments

segment values:
1: 0, 1, B,-1,-1
2: 1, 1, A, 1, 1
3: 0, 1, B, 1, 1
4: 1,-1, A, 1, 1
5:-1,-1, A, 1, 1
6: 1,-1, A, 1, 1
7: 0, 1, B,-1,-1
8: 1, 1, A, 1, 1
9: 0, 1, B, 1, 1

generator B:
9 segments

segment values:
1: 0, 1, B,-1,-1
2: 1, 1, A, 1, 1
3: 0, 1, B, 1, 1
4: 1,-1, A, 1, 1
5: 1, 0, B, 1, 1
6:-1,-1, A, 1, 1
7:-1, 0, B,-1,-1
8: 1,-1, A, 1, 1
9: 1, 0, B, 1, 1

/******************************************************
Wunderlich's Meander curve

   Re-encoded from:

   W. Wunderlich:
   Über Peano-Kurven. 
   Elemente der Mathematik, 28(1):1–10, 1973.
******************************************************/

IFS meander
IFS r
IFS r-curve

Square grid
9 segments

segment values:
1: 0, 1, 1,-1
2: 0, 1, 1,-1
3: 1, 0, 1, 1
4: 1, 0, 1, 1
5: 1, 0, 1, 1
6:-1, 0, 1, 1
7: 0,-1, 1,-1
8: 0,-1, 1,-1
9: 1, 0, 1, 1

render 1,1,1,1
ridge 0.236

/******************************************************
Dekking's curve

   Re-encoded from:

   F. M. Dekking:
   Recurrent sets. 
   Advances in Mathematics 44:78–104 (1982)
******************************************************/

IFS dekking

Square grid
25 segments

segment values:
 1: 1, 0, 1, 1
 2: 1, 0, 1, 1
 3: 0, 1,-1,-1
 4:-1, 0,-1,-1
 5: 0, 1, 1, 1
 6: 1, 0, 1, 1
 7: 0, 1,-1,-1
 8:-1, 0,-1,-1
 9:-1, 0, 1, 1
10: 0, 1,-1,-1
11: 1, 0, 1, 1
12: 1, 0, 1, 1
13: 1, 0,-1,-1
14: 0, 1, 1, 1
15: 1, 0,-1,-1
16: 0,-1, 1, 1
17: 0,-1, 1, 1
18:-1, 0,-1,-1
19: 0,-1, 1, 1
20: 0,-1,-1,-1
21: 1, 0,-1,-1
22: 0, 1, 1, 1
23: 1, 0, 1, 1
24: 0,-1,-1,-1
25: 0,-1,-1,-1

render 1,1,1,-1
ridge 0.707

/******************************************************
Z-order a.k.a. Morton-indexing, 
equivalent to the Lebesgue plane-filling curve

   Re-encoded from:

   H. Lebesgue:
   Leçons sur l’intégration et la recherche des 
   fonctions primitives, p44–45. 
   Gauthier-Villars, Paris, 1904.

   G. M. Morton:
   A computer oriented geodetic data base, and a new 
   technique in file sequencing. 
   Technical report, International Business Machines Co., 
   Ottawa, Canada, 1966.
******************************************************/

IFS z
IFS z-order
IFS morton
IFS lebesgue

Square grid
7 segments

segment values:
1: 1, 1, 1, 1
2: 0,-1, 0, 0
3: 1, 1, 1, 1
4:-2, 0, 0, 0
5: 1, 1, 1, 1
6: 0,-1, 0, 0
7: 1, 1, 1, 1

/******************************************************
U-order (Liu and Schrack)

   Re-encoded from:

   G. Schrack and X. Liu:
   The spatial U-order and some of its mathematical
   characteristics. 
   In Proc. 1995 IEEE Pacific Rim Conf. on Commun., 
   Comput., and Signal Processing, pp 416-419, 1995.
******************************************************/

IFS u
IFS u-order

Square grid
6 segments

segment values:
1: 1, 0, 1, 1
2:-1, 1, 0, 0
3: 1, 0, 1, 1
4: 1, 0, 1, 1
5:-1,-1, 0, 0
6: 1, 0, 1, 1

Render 1,1,1,1
Ridge 0

/******************************************************
U-order with L-jumps (Liu and Schrack)

   Re-encoded from:

   G. Schrack and X. Liu:
   The spatial U-order and some of its mathematical
   characteristics. 
   In Proc. 1995 IEEE Pacific Rim Conf. on Commun., 
   Comput., and Signal Processing, pp 416-419, 1995.
******************************************************/

IFS u-with-L-jumps

// this is the same traversal as above, but with zero-
// length segments added so that jumps are drawn along 
// the edges of squares instead of diagonally across.

Square grid
10 segments

segment values:
 1: 1, 0, 1, 1
 2: 0, 1, 0, 0  // first leg of jump
 3: 0, 0, 1, 1  // zero-length non-jump segment prevents 
                // the two legs from being joined into one 
 4:-1, 0, 0, 0  // second leg of jump
 5: 1, 0, 1, 1
 6: 1, 0, 1, 1
 7:-1, 0, 0, 0  // first leg of jump
 8: 0, 0, 1, 1  // zero-length non-jump segment prevents 
                // the two legs from being joined into one 
 9: 0,-1, 0, 0  // second leg of jump
10: 1, 0, 1, 1

Render 1,1,1,1
Ridge 0

/******************************************************
Gray code (according to Samet)

   Re-encoded from:

   H. Samet:
   Foundations of multidimensional and metric data 
   structures, section Ordering Space, p 199. 
   Morgan Kaufmann, 2006.
******************************************************/

IFS gray

Square grid
7 segments

segment values:
1: 1, 0, 1, 1
2: 0, 2, 0, 0
3:-1, 0,-1,-1
4: 2, 0, 0, 0
5: 1, 0, 1, 1
6: 0,-2, 0, 0
7:-1, 0,-1,-1

Render 1,1,1,1
Ridge 0

/******************************************************
Faloutsos's Double-Gray Code 
(interpretation Samet/Haverkort)

   Re-encoded from:

   C. Faloutsos. 
   Multiattribute hashing using Gray codes. 
   In Proc. 1986 ACM SIG Management of Data Conf. 
   (SIGMOD 1986), pp 227–238, 1986.

   H. Samet:
   Foundations of multidimensional and metric data 
   structures, section Ordering Space, p 199. 
   Morgan Kaufmann, 2006.

   H. Haverkort:
   Sixteen space-filling curves and traversals for
   d-dimensional cubes and simplices.
   arXiv:1711.04473, 2017.
******************************************************/

IFS double-gray

Square grid
7 segments

segment values:
1: 1, 0, 1, 1
2: 0, 2, 0, 0
3:-1, 0,-1, 1
4: 2, 0, 0, 0
5:-1, 0, 1, 1
6: 0,-2, 0, 0
7: 1, 0,-1, 1

Render 1,-1,1,1
Ridge 0.707
Azimuth 15
Altitude 35

/******************************************************
Haverkort's Inside-Out Order

   Re-encoded from:

   H. Haverkort:
   Sixteen space-filling curves and traversals for
   d-dimensional cubes and simplices.
   arXiv:1711.04473, 2017.
******************************************************/

IFS inside-out

Square grid
7 segments

segment values:
1:-1, 0, 1, 1
2: 0, 2, 0, 0
3: 1, 0,-1, 1
4: 2, 0, 0, 0
5: 1, 0, 1, 1
6: 0,-2, 0, 0
7:-1, 0,-1, 1

Render 1,1,1,-1
Ridge 0.707

/******************************************************
Z-order on sqrt(2):1 rectangle

   (see above for sources of Z-order on a square)
******************************************************/

IFS silver-z

Square grid
3 segments

segment values:
1: 1, 1.414213562373095, 1,-1
2: 0,-1.414213562373095, 0, 0
3: 1, 1.414213562373095, 1,-1

/******************************************************
Gray code on sqrt(2):1 rectangle

   (see above for sources of Gray code on a square)
******************************************************/

IFS silver-gray

Square grid
3 segments

segment values:
1: 0, 1.414213562373095, 1,-1
2: 2, 0,                 0, 0
3: 0,-1.414213562373095,-1, 1

/******************************************************
Double-Gray code on sqrt(2):1 rectangle

   (see above for sources of Double-Gray code on a square)
******************************************************/

IFS silver-double-gray

Square grid
3 segments

segment values:
1: 0, 1.414213562373095, 1,-1
2: 2, 0,                 0, 0
3: 0,-1.414213562373095,-1,-1

/******************************************************
Haverkort's Inside-Out Order on sqrt(2):1 rectangle

   (see above for sources of Inside-Out Order on a square)
******************************************************/

IFS silver-inside-out

Square grid
3 segments

segment values:
1: 0, 1.414213562373095, 1, 1
2: 2, 0,                 0, 0
3: 0,-1.414213562373095,-1, 1

/******************************************************
Polya curve on an isosceles right triangle

   Re-encoded from:

   G. Pólya. 
   Über eine Peanosche Kurve. 
   Bull. Int. Acad. Sci. Cracovie, Ser. A, 1913, 
   pp 305–313.
******************************************************/

IFS polya

Square grid
2 segments

segment values:
1: 1, 1, 1,-1
2: 1,-1, 1,-1

Ridge -1
Altitude 30
Azimuth -30

/******************************************************
View/rendering configuration to zoom in on the point
at 1/3 of Polya's curve
******************************************************/

view polya-f(1/3)

Render 1,0,1,1
Altitude 60
Azimuth -30
Centre 01010101010101010101010101010101010101010101010101010101010101010101

/******************************************************
Curve filling a 1:1:sqrt(2):2 right trapezoid, 
equivalent to 3/4 of a Polya curve
******************************************************/

IFS polya-trapezoid

Square grid
3 segments

segment values:
1: 1, 1, 1,-1
2: 1, 0, 1, 1
3: 0,-1,-1, 1

Ridge -1
Altitude 30
Azimuth -30

/******************************************************
Polya curve on a 30-60-90 triangle

   Re-encoded from:

   G. Pólya. 
   Über eine Peanosche Kurve. 
   Bull. Int. Acad. Sci. Cracovie, Ser. A, 1913, 
   pp 305–313.
******************************************************/

IFS polya-30-60-90

Cubic grid
2 segments

segment values:
1: 1, 0, 0, 1,-1
2: 0, 1,-1, 1,-1

Render 0.866025,0.5,1,1
Altitude 25
Azimuth 15

/******************************************************
Three-part curve for a 30-60-90 triangle

   Re-encoded from: (folklore)
******************************************************/

IFS tri-polya

Cubic grid
3 segments

segment values:
1: 1, 0, 0, 1,-1
2: 1, 0, 0,-1,-1
3: 0, 0, 1, 1,-1

Render 0.866025,-0.5,-1,1
Ridge 0.288675
Altitude 25
Azimuth -15

/******************************************************
Face-continuous curve following the "pinwheel" tiling
of the 2:1 right triangle

   Source of the underlying tessellation:

   attributed to John H. Conway in:
   C. Radin:
   The Pinwheel Tilings of the Plane.
   Annals of Mathematics, Second Series, Vol. 139, No. 3 
   (May, 1994), pp. 661-702 
******************************************************/

IFS pinwheel

Square grid
5 segments

segment values:
1: 1,-2, 1,-1
2: 2, 1, 1,-1
3:-2, 1,-1,-1
4: 2,-1,-1,-1
5: 2, 1, 1,-1

Render 0,1,-1,1
Azimuth 0
Altitude 75
Distance 1.1

/******************************************************
Burstedde-Holke triangle traversal

   Re-encoded from:

   C. Burstedde and J. Holke: 
   A tetrahedral space-filling curve for nonconforming 
   adaptive meshes. 
   SIAM J. Scientific Computing, 38(5), 2016.
******************************************************/

IFS burstedde-holke

Square grid
7 segments

segment values:
1: 1, 1, 1, 1
2:-1, 0, 0, 0
3: 1, 1, 1, 1
4:-1,-1, 0, 0
5: 1, 1,-1,-1
6: 0,-1, 0, 0
7: 1, 1, 1, 1

/******************************************************
Haverkort's Hill-Z triangle traversal

   Re-encoded from:

   H. Haverkort:
   Sixteen space-filling curves and traversals for
   d-dimensional cubes and simplices.
   arXiv:1711.04473, 2017.
******************************************************/

IFS hill-z

Square grid
7 segments

segment values:
1: 1, 1, 1, 1
2:-1, 0, 0, 0
3: 1, 1, 1, 1
4:-1,-1, 0, 0
5: 1, 1, 1,-1
6: 0,-1, 0, 0
7: 1, 1, 1, 1

/******************************************************
Harter-Heighway dragon

   Re-encoded from several secondary sources.
******************************************************/

IFS harter-heighway-dragon

Square grid
2 segments

segment values:
1: 1, 0, 1, 1
2: 0, 1,-1,-1

Altitude 50
Ridge 0.52

/******************************************************
Face-continuous curve filling half of the Rauzy fractal

   Source of the underlying tiling:

   Stewart Hinsley: 
   Tiles Associated with the 4th Unit Cubic Pisot Number, 
   http://www.meden.demon.co.uk/Fractals/cubic4.html, 
   retrieved 27 January 2014.
******************************************************/

IFS rauzy-triangle

Square grid
3 segments

segment values:

// 1:  1,          tan(a),      1,  1
// 2:  -x,         x tan(a),    1,  1
// 3:  2/(x-1),    0,          -1, -1
// where c is the Tribonacci constant (the real root of 
// c^3 - c^2 - c - 1) and tan(a) = sqrt(1 + 2/c)

1:  1,          1.44477612,  1,  1
2: -1.83928676, 2.65735757,  1,  1
3:  2.38297577, 0,          -1, -1

Render 0.450,-0.893,1,1
Altitude 40
Azimuth -20
Ridge 0.450

/******************************************************
Knuth's Terdragon

   Re-encoded from several secondary sources.
******************************************************/

IFS terdragon

Cubic grid
3 segments

segment values:
1: 1, 0, 0, 1, 1
2: 0, 1, 0,-1,-1
3: 1, 0, 0, 1, 1

Render 0.866,0.5,1,1
Altitude 25

/******************************************************
Ventrella's curve for the Bandt-Mekhontsev-Tetenov
fractal pinwheel tile

   From:

   Jeffrey Ventrella:
   Brainfilling curves: a fractal bestiary. 
   Eyebrain books, 2012.
******************************************************/

IFS fractal-pinwheel

Square grid
5 segments

segment values:
1: 0, 1, 1,-1
2: 1, 0, 1, 1
3: 0, 1,-1,-1
4: 1, 0,-1, 1
5: 0,-1,-1,-1

Render 1,0,-1,1
Ridge 0
Altitude 30

/******************************************************
Gosper's flowsnake

   Re-encoded from:

   M. Gardner. 
   Mathematical Games—In which "monster" curves force 
   redefinition of the word "curve". 
   Scientific American, 235(6):124–133 (1976)
******************************************************/

IFS gosper

Cubic grid
7 segments

segment values:
1: 1, 0, 0, 1, 1
2: 0,-1, 0,-1,-1
3:-1, 0, 0,-1,-1
4: 0, 0, 1, 1, 1
5: 1, 0, 0, 1, 1
6: 1, 0, 0, 1, 1
7: 0, 0,-1,-1,-1

altitude 30

/******************************************************
"Inner-Flip" Gosper

   Re-encoded from:

   E. Schouten:
   Quality of alternative terrain models, Section 6.2.
   MSc thesis, Eindhoven University of Technology,
   Dept. of Math. and Computer Science, 2012.

   or:

   J. Ventrella:
   Brainfilling curves: a fractal bestiary. 
   Eyebrain books, 2012.
******************************************************/

IFS inner-flip-gosper
IFS alternating-gosper

Cubic grid
7 segments

segment values:
1: 1, 0, 0,-1, 1
2: 0,-1, 0, 1,-1
3:-1, 0, 0, 1,-1
4: 0, 0, 1,-1, 1
5: 1, 0, 0,-1, 1
6: 1, 0, 0,-1, 1
7: 0, 0,-1, 1,-1

altitude 30

/******************************************************
Zooming in on vertex between 2nd, 3rd and 7th tile
on Gosper curve or Inner-Flip-Gosper curve
******************************************************/

View gosper-f(2/7)

Render 1,-0.4,1,1
Altitude 45
Azimuth 30
Ridge -1
Centre 2

/******************************************************
Koch snowflake (Ventralla's snowflake sweep)

   Re-encoded from:

   Jeffrey Ventrella:
   Brainfilling curves: a fractal bestiary. 
   Eyebrain books, 2012.
******************************************************/

IFS ventrella-snowflake

Cubic grid
7 segments

segment values:
1: 1, 0, 0,-1, 1
2: 1, 0, 0, 1,-1
3:-1, 0, 1,-1,-1
4: 0,-1, 0,-1, 1
5: 1, 0, 0,-1, 1
6: 0, 0,-1,-1, 1
7: 0, 0,-1, 1,-1

altitude 50

/******************************************************
Koch snowflake (Haverkort's "soft" snowflake sweep)
******************************************************/

IFS soft-snowflake

Cubic grid
7 segments

segment values:
1: 1, 0, 0, 1, 1
2: 1, 0, 0,-1,-1
3:-1, 0, 1, 1,-1
4: 0,-1, 0, 1, 1
5: 1, 0, 0, 1, 1
6: 0, 0,-1, 1, 1
7: 0, 0,-1,-1,-1

altitude 50

/******************************************************
******************************************************/


