Skip to contents

curve_arc is shape_wedge()'s arc alone, with no centroid vertex: an open path of n points on the circle centred at (x, y) with the given radius, sweeping from angle start to end (radians).

curve_arcs() is a vectorized version of curve_arc(): each argument may be a vector, recycled against the others. The result is a sketch containing one curve_arc() per recycled row, rather than a single drawable.

Usage

curve_arc(
  x = 0,
  y = 0,
  radius = 1,
  start = 0,
  end = pi/2,
  n = 100L,
  trans = trans_identity(),
  ...
)

curve_arcs(
  x = 0,
  y = 0,
  radius = 1,
  start = 0,
  end = pi/2,
  n = 100L,
  trans = trans_identity(),
  ...
)

Arguments

x, y

Centroid coordinates. Default 0.

radius

Radius. Must be non-negative. Default 1.

start, end

Start/end angle of the arc, in radians. Default 0/ pi / 2.

n

Number of points used to approximate the arc. Must be at least 2. Default 100L.

trans

A trans object applied to the shape's computed points. Default trans_identity() (no transform).

...

Arguments passed to style().

Value

A drawable.

For curve_arcs(), a sketch.

Details

Shares its point computation and argument validation with shape_wedge() via two internal helpers factored into R/shape_wedge.R (arc_points(), validate_arc_args()), differing only in which drawable(geometry = ...) they construct from and the missing centroid vertex.

style@fill has no effect for curve_arc() – see drawable's geometry documentation for why "path" geometries have no interior to fill. Passing fill via ... is still accepted (it's simply ignored at draw time), since style() is shared across every geometry.

Recycling uses purrr::pmap()'s own vctrs-based rules: any length-1 element is broadcast to the common length; mismatched lengths greater than 1 raise an error.

Examples

draw(curve_arc(start = 0, end = 3 * pi / 2))


# unlike shape_wedge(), there's no centroid vertex or fill -- just the
# arc itself
draw(curve_arc(start = pi / 4, end = pi, linewidth = 4, lineend = "round"))


# a start greater than end sweeps clockwise instead of counterclockwise
draw(curve_arc(start = pi, end = 0))


draw(curve_arcs(start = 0, end = seq(pi / 2, 2 * pi, length.out = 3)))


# concentric arcs of growing radius, all sweeping the same angle range
draw(curve_arcs(radius = seq(0.2, 1, length.out = 5), start = 0, end = pi))