Skip to contents

Makes ellipses and superellipses

Usage

ob_ellipse(
  center = ob_point(0, 0),
  a = 1,
  b = a,
  angle = 0,
  m1 = class_missing,
  m2 = class_missing,
  label = class_missing,
  alpha = class_missing,
  color = class_missing,
  fill = class_missing,
  linewidth = class_missing,
  linetype = class_missing,
  n = class_missing,
  style = class_missing,
  x0 = class_missing,
  y0 = class_missing,
  ...
)

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 specified distance. The definitional parameter is passed to the point_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. If definitional is FALSE (default), then theta is interpreted as an angle. If TRUE, then theta 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 angle theta 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)
#> <ob_ellipse>
#> @ center: <ob_point>
#>  @ x: num 0
#>  @ y: num 0
#> @ a     : num 2
#> @ b     : num 3
#> @ angle : <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, style, tibble, angle_at, geom, normal_at,
#>              point_at, tangent_at, aesthetics