Various curves in their standard forms
Usage
hilbert_curve(level = 2L, by = "Cpp")
moore_curve(level = 2L)
beta_omega_curve(level = 2L)
peano_curve(level = 2L, pattern = "vvvvvvvvv", by = "Cpp")
meander_curve(level = 2L, pattern = "fffffffff", code = rep(1, level))
h_curve(iteration = 2L)
Arguments
- level
Level of the curve.
- by
Which implementation? Only for the testing purpose.
- pattern
The orientation of units on level-2, i.e. the orientation of the 9 3x3 units. The value should be a string with 9 letters of "v"/"h" (vertical or horizontal) for the Peano curve, and "f"/"b" (forward or backward) for the Meander curve. The length of the string should be maximal 9. If the length is smaller than 9, the stringis automatically recycled.
- code
Internally used.
- iteration
Number of iterations.
Details
These are just special forms of sfc_2x2()
, sfc_3x3_peano()
, sfc_3x3_meander()
and sfc_h()
.
Examples
hilbert_curve(2)
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 1 0
#> [3,] 1 1
#> [4,] 0 1
#> [5,] 0 2
#> [6,] 0 3
#> [7,] 1 3
#> [8,] 1 2
#> [9,] 2 2
#> [10,] 2 3
#> [11,] 3 3
#> [12,] 3 2
#> [13,] 3 1
#> [14,] 2 1
#> [15,] 2 0
#> [16,] 3 0
draw_multiple_curves(
hilbert_curve(3),
hilbert_curve(4),
nrow = 1
)
draw_multiple_curves(
moore_curve(3),
moore_curve(4),
nrow = 1
)
draw_multiple_curves(
beta_omega_curve(3),
beta_omega_curve(4),
nrow = 1
)
draw_multiple_curves(
peano_curve(2),
peano_curve(3),
nrow = 1
)
draw_multiple_curves(
peano_curve(3, pattern = "vh"),
peano_curve(3, pattern = "vvvhhhvvv"),
nrow = 1
)
draw_multiple_curves(
meander_curve(2),
meander_curve(3),
nrow = 1
)
draw_multiple_curves(
meander_curve(3, pattern = "fbfbfbfbf"),
meander_curve(3, pattern = "bbbbbffff"),
nrow = 1
)
draw_multiple_curves(
h_curve(1),
h_curve(2),
nrow = 1, closed = TRUE
)