3x3 Meander Curve
Zuguang Gu (z.gu@dkfz.de)
2024-09-05
Source:vignettes/meander_curve.Rmd
meander_curve.Rmd
Base patterns
The Meander curve has a different set of base units.
The expansions are very similar as the Hilbert curve, but it also has a flipped version where the units can be flipped horizontally or vertically on various levels.
draw_rules_3x3_meander(flip = TRUE)
On each level expansion, there are two traverse paths:
plot_traverse_paths(SFC_RULES_3x3_MEANDER, SFC_RULES_3x3_MEANDER@rules$I[[1]])
Curves
All possible forms of the Meander curve on level 3 taking R(0)
as the seed:
draw_multiple_curves(
sfc_3x3_meander("R", code = "111"),
sfc_3x3_meander("R", code = "112"),
sfc_3x3_meander("R", code = "121"),
sfc_3x3_meander("R", code = "122"),
sfc_3x3_meander("R", code = "211"),
sfc_3x3_meander("R", code = "212"),
sfc_3x3_meander("R", code = "221"),
sfc_3x3_meander("R", code = "222"),
nrow = 2, lwd = 2)
The curves on level 3 taking the nine base patterns respectively:
draw_multiple_curves(
sfc_3x3_meander("I", code = "111"),
sfc_3x3_meander("R", code = "111"),
sfc_3x3_meander("L", code = "111"),
sfc_3x3_meander("U", code = "111"),
sfc_3x3_meander("B", code = "111"),
sfc_3x3_meander("D", code = "111"),
sfc_3x3_meander("P", code = "111"),
sfc_3x3_meander("Q", code = "111"),
sfc_3x3_meander("C", code = "111"),
nrow = 3, lwd = 2)
Unit flipping
Flipping (horizotal or vertical) can be applied by specifying the index of the hierarchical unit on the curve.
p = sfc_3x3_meander("I", 11)
draw_multiple_curves(
p,
sfc_flip_unit(p, "1"), # bottom left
sfc_flip_unit(p, "2"), # bottom middle
sfc_flip_unit(p, c("6", "7", "8", "9")), # top left, four units
nrow = 2
)
Number of different forms
The total number of different forms of the Meander curve on level \(k\) is composed by two parts: \(9 \cdot 4 \cdot 2^k\) is the number by applying the expanding rules, and \(2^{\frac{9^k - 1}{8}}\) is the number of units on all levels where each unit can be flipped independently.
\[ 9 \cdot 4 \cdot 2^k \cdot 2^{\frac{9^k - 1}{8}} \]
Seed as a sequence
seed = sfc_sequence("IILILILI", rot = -90, universe = sfc_universe(SFC_RULES_3x3_MEANDER))
plot(seed, grid = TRUE)
sfc_3x3_meander(seed, code = "111") |> plot(lwd = 2)