Make SpatialPolygons ellipses

sp_ellipses(
  xcenter,
  ycenter,
  setnames = NULL,
  xradius = 1,
  yradius = 2,
  rotation_degrees = c(0),
  n = 60,
  ...
)

Arguments

xcenter, ycenter

numeric vector that defines the x and y coordinate position of the center of each ellipse.

setnames

vector that contains names for each ellipse, stored in the sp::SpatialPolygons object as the polygon name. When setnames is NULL then integer index positions are used.

xradius, yradius

numeric vector that defines the radius of each ellipse along the x-axis and y-axis, respectively. Each vector is recycled to length(xcenter).

n

integer value indicating the number of subdivisions to use in the circle.

...

additional arguments are ignored.

rotation_degree

numeric vector representing degrees to rotate each ellipse after it is created, where values are conformed to between 0 and 360, rotating clockwise.

Value

object sp::SpatialPolygons with a number of ellipses defined by length(xcenter).

Details

This function creates one or more ellipses as sp::SpatialPolygons objects.

Examples

sp <- sp_ellipses(c(3, 2), c(2, 3),
   xradius=c(1, 4),
   yradius=c(5, 2))
plot(sp, col=c("#FF000077", "#FFDD0077"));
axis(1, las=2); axis(2, las=2);
points(x=c(3, 2), y=c(2, 3), pch=c("1", "2"), add=TRUE);