1
2##==============================================================================
3## getellipse   : calculates the x-y values for (part of) an ellipse
4##==============================================================================
5
6getellipse <- function (rx=1, ry=rx, mid=c(0,0), dr=0.01,
7  angle=0, from=-pi, to=pi) {
8
9  dr <- abs(dr)
10  if (to < from) to <- 2*pi + to
11  x  <- c( seq(from,to,by=dr), to)
12  if (x[length(x)] == x[length(x)-1])
13    x <- x[-length(x)]
14  xy <- cbind( mid[1] + rx * cos(x), mid[2] + ry * sin(x))
15
16  if (angle != 0)
17    xy <- rotatexy (xy, angle=angle, mid=mid)  # rotate around mid
18  return(xy)
19}
20