Skip to contents

d_fslash() is a wrapper around MZ() to create a forward slash path convenience wrapper. d_bslash() is a wrapper around MZ() to create a backward slash path convenience wrapper. They are vectorized in their y_top, x_right, y_bottom, x_left, and w arguments.

Usage

d_fslash(
  y_top,
  x_right,
  y_bottom,
  x_left,
  w,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE),
  height = getOption("dee.height", NULL),
  nib = c("horizontal", "diagonal", "square", "vertical"),
  left = nib,
  right = nib
)

d_bslash(
  y_top,
  x_right,
  y_bottom,
  x_left,
  w,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE),
  height = getOption("dee.height", NULL),
  nib = c("horizontal", "diagonal", "square", "vertical"),
  left = nib,
  right = nib
)

Arguments

y_top, x_right, y_bottom, x_left

The most extreme x and y values of the slash shape.

w

The (stroke) width of the slash "line".

...

Passed to MZ().

origin_at_bottom, height

If origin_at_bottom is TRUE then y (and any y1 and y2) coordinates is transformed by height - y for absolute coordinates and -y for relative coordinates.

nib, left, right

The shape of the "nib" tracing the line. This only affects the left and right ends.

Value

A dee() object.

Examples

d_h <- d_fslash(2, 8, 8, 2, 1)
if (requireNamespace("omsvg", quietly = TRUE) &&
    requireNamespace("nanosvgr", quietly = TRUE)) {
  plot(d_h, height = 10, width = 10,
       fill = "red", stroke = "black", stroke_width = 4)
}

d_s <- d_bslash(2, 8, 8, 2, 1, nib = "square")
if (requireNamespace("omsvg", quietly = TRUE) &&
    requireNamespace("nanosvgr", quietly = TRUE)) {
  plot(d_s, height = 10, width = 10,
       fill = "red", stroke = "black", stroke_width = 4)
}

d_v <- d_fslash(2, 8, 8, 2, 1, nib = "vertical")
if (requireNamespace("omsvg", quietly = TRUE) &&
    requireNamespace("nanosvgr", quietly = TRUE)) {
  plot(d_v, height = 10, width = 10,
       fill = "red", stroke = "black", stroke_width = 4)
}

d_d <- d_bslash(2, 8, 8, 2, 1, nib = "diagonal")
if (requireNamespace("omsvg", quietly = TRUE) &&
    requireNamespace("nanosvgr", quietly = TRUE)) {
  plot(d_d, height = 10, width = 10,
       fill = "red", stroke = "black", stroke_width = 4)
}