ellipse | R Documentation |
Return ellipse points. Usefull for ploting ellipses.
ellipse( saxes = c(1, 1), loc = c(0, 0), theta = 0, n = 201, method = c("default", "angle", "distance") )
saxes |
a (2 \times 1) vector of the length of the ellipse semi-axes. |
loc |
a (2 \times 1) vector of the Cartesian coordinates of the ellipse center. |
theta |
the angle of rotation of the elllipse (in radians). |
n |
the number of points returned by the function. |
method |
The method used to return the points: either |
"default"
returns points according to the polar equation;
"angle"
returns points radially equidistant;
"distance"
returns points that are equidistant on the ellipse arc.
A (n \times 2) matrix whose columns correspond to the Cartesian coordinates of the points lying on the ellipse.
# Ellipse parameters saxes <- c(5,2) loc <- c(0,0) theta <- pi/4 # Plot plot(ellipse(saxes, loc, theta, n=500),type="l") points(ellipse(saxes, loc, theta, n=30),pch=20,col="red") points(ellipse(saxes, loc, theta, n=30, method="angle"),pch=20,col="blue") points(ellipse(saxes, loc, theta, n=30, method="distance"),pch=20,col="green")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.