Skip to contents

Constructor of the sfc_base class

Usage

sfc_base(
  letter,
  in_direction,
  out_direction,
  grob = NULL,
  primary = TRUE,
  open = TRUE
)

Arguments

letter

A single letter to represent the base pattern.

in_direction

The direction of the segment that enters the point, measured in the polar coordinate system, in degrees.

out_direction

The direction of the segment that leaves the point, measured in the polar coordinate system, in degrees.

grob

A grid::grob() object of this base pattern. If it is not set, it is generated according to in_direction and out_direction.

primary

Currently, going forward, turning left and turning right can be set as primary base patterns because other high-level patterns can be built from them.

open

Can the base pattern be connected to other base patterns?

Value

An sfc_base object.

Details

The "base pattern" is designed not only for single point but also for combination of points that form a "base curve". However, currently, it is fixed to the single point base pattern.

Currently, this package supports 2x2 and 3x3 space-filling curves that fills grids in 2D space constructed by the Gaussian integers. And when the curve expands, we only allow the segments to go forward, backward, left and right. Thus there are the following base patterns pre-defined in this package:

  • BASE_I/BASE_J: go forward.

  • BASE_R: turn right.

  • BASE_L: turn left.

  • BASE_U: go backward.

  • BASE_B: leave the start point where the start point is closed.

  • BASE_D: leave the start point where the start point is closed.

  • BASE_P: return to the end point where the end point is closed.

  • BASE_Q: return to the end point where the end point is closed.

  • BASE_C: self-closed.

The base pattern determines the final form of the curve.

Examples

BASE_I
#> Base: I, with 90 degrees in and 90 degrees out.