Skip to contents

d_ellipse() is a wrapper around M() and AZ() to create ellipse shaped paths. It's vectorized in its x, y, rx, and ry arguments. d_circle() is a special case to create circle shaped paths. It's vectorized in its x, y, and r arguments.

Usage

d_ellipse(
  x,
  y = NULL,
  rx,
  ry = rx,
  a = 0,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE),
  height = getOption("dee.height")
)

d_circle(x, y = NULL, r, ...)

Arguments

x

If y is NULL will be coerced by affiner::as_coord2d(). Else a numeric vector.

y

Either NULL or a numeric vector.

rx, ry

The radii of the ellipse.

a

The angle of rotation (will be coerced by affiner::degrees()).

...

Passed to M() and AZ().

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.

r

The radius of the circle.

Value

A dee() object.

Examples

d_circle(x = 5, y = 5, r = 2)
#> <dee[1]>
#> M 5,7 A 2,2 0,0,0 5,3 2,2 0,0,0 5,7 Z
d_ellipse(x = 5, y = 5, rx = 2, ry = 3)
#> <dee[1]>
#> M 5,8 A 2,3 0,0,0 5,2 2,3 0,0,0 5,8 Z
if (requireNamespace("omsvg", quietly = TRUE) &&
    requireNamespace("nanosvgr", quietly = TRUE)) {
  plot(d_ellipse(x = 5, y = 5, rx = 2, ry = 3),
       height = 10, width = 10,
       fill = "red", stroke = "black", stroke_width = 4)
}