d_rect() is a wrapper around d_polygon() to create
rectangle shaped paths.
It's vectorized in its x, y, w, and h arguments.
Arguments
- x
If
yisNULLwill be coerced byaffiner::as_coord2d(). Else a numeric vector.- y
Either
NULLor a numeric vector.- w, h
The width and height of the rectangle.
- a
The angle of rotation (will be coerced by
affiner::degrees()).- ...
Passed to
d_polygon().- origin_at_bottom, height
If
origin_at_bottomisTRUEtheny(and anyy1andy2) coordinates is transformed byheight - yfor absolute coordinates and-yfor relative coordinates.
Value
A dee() object.
Examples
d_rect(x = 5, y = 5, w = 4, h = 6)
#> <dee[1]>
#> M 3,2 3,8 7,8 7,2 Z
if (requireNamespace("omsvg", quietly = TRUE) &&
requireNamespace("nanosvgr", quietly = TRUE)) {
plot(d_rect(x = 5, y = 5, w = 4, h = 6),
height = 10, width = 10,
fill = "red", stroke = "black", stroke_width = 4)
}