| unit_orientation | R Documentation |
Flip units
unit_orientation(p, index = "")
## S4 method for signature 'sfc_nxn'
sfc_flip_unit(p, index = "", to = NULL)
## S4 method for signature 'sfc_unit'
sfc_flip_unit(p, bases)
p |
The corresponding object. |
index |
A string of digits representing the path on the hierarchy of the curve. The left side corresponds to the top level and the right side corresponds to the bottom level on the curve. For the 2x2 curve, the digits can only be 1-4, and for the Peano and Meander curves, the digits can be 1-9. The hierarchical index should be specified in a format of 'i1:i2:i3:...' where ':' can be replaced by any non-number character. For 2x2 and 3x3 curves, ':' can be omitted and the hierarchical index can be specified as 'i1i2i3...'. See examples in ['sfc_index()']. The value can also be a vector where each flipping is applied in sequence. |
to |
The orientation to flip to. If the specified unit already has such orientation, the function returns the original curve. |
bases |
Normally use ['BASE_LIST']. |
The orientation of a unit is the orientation of the line connected by the entry-corner and exit-corner of that unit.
A unit in the curve is represented as a square block (e.g. '2^k x 2^k' for the 2x2 curve and '3^k x 3^k' for the Peano and Meander curves, 'k' between 1 and the level of the curve). In the 2x2 curve, if an unit can be flipped, it is symmetric, thus flipping in the 2x2 curve does not change its form. The flipping is mainly applied on the Peano curve and the Meander curves. Peano curve only allows flippings by the diagonals and the Meander curve only allows flipping horizontally or vertically. The type of flipping is choosen automatically in the function.
Currently, 'sfc_flip_unit()' only works on curves with a single base pattern as the seed.
'unit_orientation()' returns a string one of "vertical", "horizontal", "diagonal_1" and "diagonal_-1".
'sfc_flip_unit' returns an 'sfc_nxn' object.
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, "3"), # bottom right
nrow = 2)
p = sfc_3x3_peano("I", level = 3)
draw_multiple_curves(
p,
sfc_flip_unit(p, ""),
sfc_flip_unit(p, "2"),
sfc_flip_unit(p, "2:1"),
nrow = 2)
p = sfc_3x3_peano("I", level = 2)
draw_multiple_curves(p,
sfc_flip_unit(p, c("4", "7")),
sfc_flip_unit(p, c("1", "2", "3", "5", "6", "8", "9")),
nrow = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.