p = sfc_3x3_peano("I", level = 3)
# flip the global curve
draw_multiple_curves(
p,
sfc_apply(p, 0, sfc_flip_unit),
nrow = 1
)
# flip all the subunits on depth = 1
draw_multiple_curves(
p,
sfc_apply(p, 1, sfc_flip_unit),
nrow = 1
)
# flip all the subunits on depth = 2
draw_multiple_curves(
p,
sfc_apply(p, 2, sfc_flip_unit),
nrow = 1
)
# flip all level-1 patterns on the Peano curve to horizontal
# only works on the lowest subunit,
p2 = sfc_apply(p, 2, function(x) {
if(level1_unit_orientation(x) == "vertical") {
sfc_flip_unit(x)
} else {
x
}
})
# then on depth=1, only flip the unit with odd index
p3 = sfc_apply(p2, 1, function(x, i) {
if(i %% 2 == 1) {
sfc_flip_unit(x)
} else {
x
}
})
draw_multiple_curves(p2, p3, nrow = 1)
# flip all level-1 patterns to vertical
p3 = sfc_apply(p, 2, function(x) {
if(level1_unit_orientation(x) == "horizontal") {
sfc_flip_unit(x)
} else {
x
}
})
draw_multiple_curves(p, p3, nrow = 1)
Run the code above in your browser using DataLab