Skip to contents

Transformations of a sequence

Usage

# S4 method for sfc_sequence
sfc_rotate(p, rot)

# S3 method for sfc_sequence
^(e1, e2)

# S4 method for sfc_sequence
sfc_hflip(p, fix_ends = FALSE, bases = NULL)

# S4 method for sfc_sequence
sfc_vflip(p, fix_ends = FALSE, bases = NULL)

# S4 method for sfc_sequence
sfc_dflip(p, slop = 1L, fix_ends = FALSE, bases = NULL)

# S4 method for sfc_sequence
sfc_reverse(p)

# S3 method for sfc_sequence
rev(x)

Arguments

p, e1

An sfc_sequence object.

rot, e2

Rotation measured in the polar coordinate system, in degrees.

fix_ends

By default, the curve is flipped as a complete whole, which means, the associated entry and exit directions of the curve is also adjusted accordingly. When flipping subunits in a curve, e.g. level-1 subunits in a Peano curve, we want the entry and exit direction of the subunit not changed so that the subunits are still connected in the curve after the flipping. In this case, fix_ends can be set to TRUE, then only the subunits are flipped while the connections to neighbouring subunits are not affected. See the Examples section.

bases

A list of base patterns, consider to use BASE_LIST. It is only used when fix_ends = TRUE.

slop

Slop of the diagonal. Value can only be 1 or -1.

x

An sfc_sequence object.

Value

An sfc_sequence object.

Details

  • sfc_rotate() and ^() rotate each base pattern.

  • sfc_hflip() flips a sequence horizontally.

  • sfc_vflip() flips a sequence vertically.

  • sfc_dflip() flips a sequence against a diagonal line (with slop 1 or -1).

Examples

p = sfc_3x3_meander("R", 2, rot = -90)
draw_multiple_curves(
    p, 
    sfc_hflip(p), 
    sfc_hflip(p, fix_ends = TRUE), 
    nrow = 1)

p = sfc_3x3_meander("L", 2, rot = -90)
draw_multiple_curves(
    p, 
    sfc_vflip(p), 
    sfc_vflip(p, fix_ends = TRUE), 
    nrow = 1)

p = sfc_3x3_peano("I", 2)
draw_multiple_curves(
    p, 
    sfc_dflip(p, 1), 
    sfc_dflip(p, 1, fix_ends = TRUE), 
    nrow = 1)