Skip to contents

Returns the un-roughened geometry of an arrowhead whose tip is at (tipx, tipy) and which points along angle. The grob layer roughens and paints it, so this stays pure geometry and reproduces on every device. Styles: "triangle_open" (a two-stroke V), "triangle_filled" (a solid triangle), "barb" (swept-back harpoon barbs), "fishtail" (a forked swallowtail), "dot" (a blob at the tip) and "bar" (a perpendicular tick).

Usage

arrowhead(
  tipx,
  tipy,
  angle,
  length,
  half_angle = 25 * pi/180,
  style = "triangle_open"
)

Arguments

tipx, tipy

Tip position (inch space).

angle

Direction the arrow points, in radians (the end tangent).

length

Head length in inches.

half_angle

Half-angle of the wings, in radians. Default ~25 degrees.

style

One of sketch_arrowheads().

Value

A list with strokes (a list of 2-column (x, y) polylines to stroke), polygons (a list of (x, y) rings to fill) and dots (list(x, y, r) or NULL).

Examples

arrowhead(1, 1, angle = 0, length = 0.2, style = "barb")
#> $strokes
#> list()
#> 
#> $polygons
#> $polygons[[1]]
#>              x         y
#> [1,] 1.0000000 1.0000000
#> [2,] 0.8187384 1.0845237
#> [3,] 0.7500000 1.0000000
#> [4,] 0.8187384 0.9154763
#> [5,] 1.0000000 1.0000000
#> 
#> 
#> $dots
#> NULL
#>