sfc_rules | R Documentation |
Constructor of the sfc_rules class
sfc_rules(rules, bases, flip = list(), name = "sfc_rules")
rules |
A list of rules. |
bases |
A list of base patterns. |
flip |
A list of rules. They are "flipped" version of |
name |
A self-defined string. |
It is mainly used internally.
rules
is a two-level list. It is in a format of rules[[ base ]][[ expansion_code ]] = sfc_unit()
.
In the following example where we define the expansion rules for the 2x2 curve:
UNIVERSE_2x2 = c("I", "R", "L", "U", "B", "D", "P", "Q", "C") RULES_2x2 = list() RULES_2x2[["I"]][[1]] = sfc_unit(c("R", "L", "L", "R"), rot = 0, universe = UNIVERSE_2x2)
I
is the level-0 base pattern, [[1]]
corresponds to the first form of expansion to level-1, and the value
assigned is a sfc_unit()
object which is basically a list of base patterns.
Then we also need to provide the base patterns which define how to extend the curve. The list of base patterns
is assigned to the bases
argument. In the same example, we set bases
as:
list("I" = BASE_I, "R" = BASE_R, "L" = BASE_L, "U" = BASE_U, ...)
where e.g. BASE_I
is a pre-defined base pattern in the sfc_base
class.
There are the following pre-defined rules:
SFC_RULES_2x2
SFC_RULES_3x3_PEANO
SFC_RULES_3x3_MEANDER
SFC_RULES_3x3_COMBINED
SFC_RULES_4x4_MEANDER_1
SFC_RULES_4x4_MEANDER_2
Check https://github.com/jokergoo/sfcurve/blob/master/R/zz_global.R to see how these pre-defined rules are constructed.
An sfc_rules
object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.