Skip to contents

x_ellipse_left() returns the x-coordinate of the leftmost point and x_ellipse_right() returns the x-coordinate of the rightmost point on a (possibly rotated) ellipse at a given y value. y_ellipse_top() returns the y-coordinate of the topmost point and y_ellipse_bottom() returns the y-coordinate of the bottommost point on a (possibly rotated) ellipse at a given x value. x_ellipse_left() and x_ellipse_right() return NaN if y is outside the vertical extent of the ellipse. y_ellipse_top() and y_ellipse_bottom() return NaN if x is outside the horizontal extent of the ellipse.

Usage

x_ellipse_left(
  y,
  xc,
  yc,
  rx,
  ry = rx,
  a = 0,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE)
)

x_ellipse_right(
  y,
  xc,
  yc,
  rx,
  ry = rx,
  a = 0,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE)
)

y_ellipse_top(
  x,
  xc,
  yc,
  rx,
  ry = rx,
  a = 0,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE)
)

y_ellipse_bottom(
  x,
  xc,
  yc,
  rx,
  ry = rx,
  a = 0,
  ...,
  origin_at_bottom = getOption("dee.origin_at_bottom", FALSE)
)

Arguments

y

The y value at which to evaluate the ellipse.

xc, yc

The center of the ellipse.

rx, ry

The x and y radii of the (unrotated) ellipse.

a

The counter-clockwise angle of rotation of the ellipse (will be coerced by affiner::degrees()).

...

Should be empty.

origin_at_bottom

If TRUE, the origin is at the bottom of the coordinate system (i.e. y increases upward).

x

The x value at which to evaluate the ellipse.

Value

A numeric value.

See also

Examples

# Unrotated ellipse centered at (5, 5) with rx=3, ry=4
x_ellipse_left(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 0)
#> [1] 2
x_ellipse_right(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 0)
#> [1] 8
# Rotated 90 degrees: rx and ry swap roles
x_ellipse_left(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 90)
#> [1] 1
x_ellipse_right(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 90)
#> [1] 9
# Unrotated ellipse centered at (5, 5) with rx=3, ry=4
y_ellipse_top(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 0)
#> [1] 1
y_ellipse_bottom(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 0)
#> [1] 9
# Rotated 90 degrees: rx and ry swap roles
y_ellipse_top(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 90)
#> [1] 2
y_ellipse_bottom(5, xc = 5, yc = 5, rx = 3, ry = 4, a = 90)
#> [1] 8