sfcurve

\(n \times n\) space-filling curves.

Basic

Example

2x2 curve

library(sfcurve)
p = sfc_2x2("I", "2222", rot = 270)
p
## An sfc_2x2 object.
##   Increase mode: 2 x 2
##   Level: 4
##   Expansion rule: 2x2 
## 
## A sequence of 256 base patterns.
##   I(270)L(270)L(0)R(90)   I(0)R(0)R(270)L(180)
##   L(270)R(0)R(270)I(180)  R(180)L(90)L(180)I(270)
##   .... other 28 lines ....
##   I(270)L(270)L(0)R(90)   I(0)R(0)R(270)L(180)
##   L(270)R(0)R(270)I(180)  R(180)L(90)L(180)I(270)
## 
## Seed: A sequence of 1 base pattern.
##   I(270)
plot(p)

3x3 Peano curve

p = sfc_3x3_peano("I", "1111")
plot(p)

Initialized by a simple curve

p = sfc_seed("LLLILILIILIILIIILIIILIIII")
p2 = sfc_2x2(p, "1111")
plot(p2)