Makes ellipses and superellipses
Usage
ob_ellipse(
center = ob_point(0, 0),
a = 1,
b = a,
angle = 0,
m1 = numeric(0),
m2 = numeric(0),
label = character(0),
alpha = numeric(0),
color = character(0),
fill = character(0),
linewidth = numeric(0),
linetype = numeric(0),
n = numeric(0),
style = class_missing,
x0 = numeric(0),
y0 = numeric(0),
...
)
Arguments
- center
point at center of ellipse. Settable.
- a
distance of semi-major axis. Settable.
- b
distance of semi-minor axis. Settable.
- angle
ellipse rotation. Settable.
- m1
exponent of semi-major axis. Settable. Controls roundedness of superellipse
- m2
exponent of semi-minor axis. Settable. By default equal to
m1
. If different, some functions may not work as expected (e.g.,point_at
).- label
A character, angle, or label object
- alpha
numeric value for alpha transparency
- color
character string for color
- fill
character string for fill color
- linewidth
Width of lines
- linetype
type of lines
- n
number of points in ellipse (default = 360). Settable.
- style
gets and sets style parameters
- x0
x-coordinate of center point. If specified, overrides x-coordinate of
@center
.- y0
x-coordinate of center point. If specified, overrides y-coordinate of
@center
.- ...
<
dynamic-dots
> arguments passed to style object
Slots
length
Gets the number of ellipses
tibble
Gets a tibble (data.frame) containing parameters and styles used by
ggforce::geom_ellipse
.geom
A function that converts the object to a geom. Any additional parameters are passed to
ggforce::geom_ellipse
.normal_at
A function that finds a point perpendicular to the ellipse at angle
theta
at the specifieddistance
. Thedefinitional
parameter is passed to thepoint_at
function. If a point is supplied instead of an angle, the point is projected onto the ellipse and then the normal is calculated found from the projected point.point_at
A function that finds a point on the ellipse at an angle
theta
. Ifdefinitional
isFALSE
(default), thentheta
is interpreted as an angle. IfTRUE
, thentheta
is the parameter in the definition of the ellipse in polar coordinates.tangent_at
A function that finds a tangent line on the ellipse. Uses
point_at
to find the tangent point at angletheta
and then returns the tangent line at that point. If a point is supplied instead of an angle, the point is projected onto the ellipse and then the tangent line is found from there.
Examples
# specify center point and semi-major axes
p <- ob_point(0,0)
ob_ellipse(p, a = 2, b = 3)
#> <ggdiagram::ob_ellipse>
#> @ center: <ggdiagram::ob_point>
#> @ x: num 0
#> @ y: num 0
#> @ a : num 2
#> @ b : num 3
#> @ angle : <ggdiagram::radian>
#> @ radian: num 0
#> @ m1 : num 2
#> @ m2 : num 2
#> Other props: label, alpha, color, fill, linewidth, linetype,
#> n, area, bounding_box, focus_1, focus_2, length,
#> perimeter, polygon, style, tibble, angle_at, geom,
#> normal_at, place, point_at, tangent_at, aesthetics