aspace (version 0.1)

ellipse3: Ellipse drawing tool

Description

A convenient tool for plotting circles or ellipses with the functionality of rotation about an angle theta (in radians). The function can also be used to capture coordinates of the perimeter of the shape for further usage outside the function.

Usage

ellipse3(cx, cy, rx, ry, theta = 0, yaxis = TRUE, pointsonly = FALSE, fill = FALSE, ...)

Arguments

cx
x-coordinate of ellipse center
cy
y-coordinate of ellipse center
rx
radius along x-axis
ry
radius along y-axis
theta
rotation angle in radians from north
yaxis
Depreciated. This parameter adjusts the size correct in the y- or x-axis, as plotting is generally not square. Therefore, use par(pty="s") to eliminate the need for this parameter.
pointsonly
Boolean: If TRUE, ellipse will not be plotted, but rather the coordinates of the perimeter are returned in a list object for further use. The calc.sde function utilizes these coordinates to build a textfile of coordinates which the makeshapes function us
fill
Boolean: If TRUE, the plotted ellipse will be shaded in
...
Any additional parameters suitable for plotting

Value

  • This function returns a plot of an ellipse when pointsonly = FALSE. When pointsonly = TRUE, the result is a list of x,y coordinates
  • xA numeric vector of x-coordinates
  • yA numeric vector of y-coordinates

Details

This function plots an ellipse with center (cx, cy). The rotation angle in radians (form north) is given as theta. Note that a circle can be obtained by rx=ry, in which case theta is not very useful. Additional parameters (e.g., colour and fill density) can be provided as indicated by the '...' in the function call.

See Also

calc.sde, as.radians

Examples

Run this code
plot.new()
  plot(10,10, type="n")
  ellipse3(cx = 10, cy = 8, rx = 2, ry = 1, theta = as.radians(45), yaxis = TRUE, pointsonly = FALSE, fill = FALSE, col=6)

Run the code above in your browser using DataLab