Skip to contents

Reduce a curve

Usage

# S4 method for sfc_nxn
sfc_reduce(p, to = sfc_level(p) - 1)

# S4 method for matrix
sfc_reduce(p, to = level - 1, mode = NULL)

add_base_structure(gb, level = 1)

Arguments

p

An sfc_nxn object.

to

Which level to reduce to? Value should be between 1 and sfc_level(p) - 1.

mode

Mode of the curve.

gb

A grob object returned by sfc_grob() or a sfc_nxn object then sfc_grob() is internally applied.

level

The level of the unit.

Value

A two-column matrix of coordinates of the reduced curve.

Details

The reduction is applied on the coordinates of points.

add_base_structure() adds a base structure on a certain level to the curve.

Examples

p = sfc_3x3_peano("I", level = 3)
draw_multiple_curves(
    p, 
    sfc_reduce(p, 2), 
    sfc_reduce(p, 1), 
    nrow = 1)

p = hilbert_curve(level = 4)
draw_multiple_curves(
    p, 
    sfc_reduce(p, 3), 
    sfc_reduce(p, 2), 
    nrow = 1)

p = hilbert_curve(3)
draw_multiple_curves(
    add_base_structure(p, level = 1),
    add_base_structure(p, level = 2),
    nrow = 1
)