mod_reflect: Add a reflection modification to a shape

View source: R/add_mod.R

mod_reflectR Documentation

Add a reflection modification to a shape

Description

A reflection modification reflects a shape around a reference line. Reflections are not valid for refline shapes.

Usage

mod_reflect(
  pj,
  ref = "h",
  x1 = NA,
  y1 = NA,
  x2 = NA,
  y2 = NA,
  s = NA,
  i = NA,
  a = NA,
  au = "r",
  shape = ".",
  name = "."
)

Arguments

pj

an object of class 'pj'.

ref

NA or character vector identifying pre-defined reference lines. See the the ref argument section.

x1

NA or numeric vectors indicating either a vertical reference line at the value contained in x1 (if used alone) or the horizontal location of a primary point used to define a reference line (if used with y1).

y1

NA or numeric vectors indicating either a horizontal reference line at the value contained iny1 (if used alone) or the vertical location of a primary point used to define a reference line (if used with x1).

x2

NA or numeric vector indicating the vertical locations of the secondary points to define lines in conjunction with x1, y1, and y2.

s

NA or numeric vector indicating the slope of the reference line.

i

NA or numeric vector indicating the x-intercept of the reference line.

a

NA or numeric vector indicating the angle of the reference line.

au

NA or character vector indicating the angle units to be used where 'd' indicates degrees, 'g' indicates gradians, 'p' indicates proportion of a full revolution, and 'r' indicates radians.

shape

character scalar indicating the type of shape to which the mod will be applied.

name

character scalar name to give to the specified mod. The special value "." indicates that the pj package should create a default name for the mod.

Value

pj with the reflection modification applied to the specified shape.

The ref argument

  • 'i' indicates reflection across the identity line,

  • 'x' indicates reflection across the x-axis,

  • 'y' indicates reflection across the y-axis,

  • 'l' indicates reflection across the vertical line through the left edge of a shape's bounding rectangle,

  • 'r' indicates reflection across the vertical line through the right edge of a shape's bounding rectangle,

  • 'b' indicates reflection across the horizontal line through the bottom edge of a shape's bounding rectangle,

  • 't' indicates reflection across the horizontal line through the top edge of a shape's bounding rectangle,

  • 'h' indicates horizontal reflection across the vertical midline of the shape's bounding rectangle.

  • 'v' indicates vertical reflection across the horizontal midline of the shape's bounding rectangle.

  • 'd' indicates reflection across the line through th downward diagonal between the top-left and bottom-right corners of a shape's bounding rectangle, and

  • 'u' indicates reflection across the line through the upward diagonal between to bottom-left and top-right corners of a shape's bounding rectangle.

Defining reference lines

Valid combinations of non-NA locating arguments are given below.

ref

Pre-defined reference line

x1

Vertical line at x1.

y1

Horizontal line at y1.

x1 + y1 + x2 + y2

Point-point definition (line through (x1, y1) and (x2, y2)).

x1 + y1 + a

Point-angle definition (line through (x1, y1) at angle a).

x1 + y1 + i

Point-intercept definition (line through intercept and (x1, y1)).

x1 + y1 + s

Point-slope definition (line through (x1, y1) with slope s).

a + i

Angle-intercept definition (line through intercept at angle a).

s + i

Slope-intercept definition (line through intercept with slope s).

Argument recycling

The argument set {x, y, ref, s, i, x2, y2, a, au, xu, yu} is recycled with the number of subshapes defined for a given shape. For point, area, and ribbon shapes, all arguments in the set must be scalar. For segment shapes, arguments in the set must be recyclable with the number of segments defined by that shape. For shapes that define polygons, arguments in the set must be recyclable with the number of polygons defined by the shape.

See Also

Other add_mod: mod_dilate(), mod_rotate(), mod_translate()


j-martineau/pj documentation built on March 19, 2022, 5:32 a.m.