f_ellipse | R Documentation |
theta
Ellipse function with angle argument theta
f_ellipse(x0 = 0, y0 = 0, a = 1, b = 1, alpha = 0, theta0 = 0, dir = 1)
x0 |
A numeric value. The x-axis value of the ellipse center. |
y0 |
A numeric value. The y-axis value of the ellipse center. |
a |
A numeric value. The major radius. |
b |
A numeric value. The minor radius. |
alpha |
A numeric value. The rotation angle of the ellipse. |
theta0 |
A numeric value. The (anti-clockwise) angle/rotation of the starting point on the ellipse. |
dir |
A numeric value, interpreted as either
|
thetas <- seq(0, 2 * pi, length = 200)
# circle with radius 1 and center at 0/0
ellipse1 <- f_ellipse()
plot(ellipse1(thetas), asp = 1, type = "l")
points(0, 0, pch = 4)
# ellipse with radii 0.2 and 0.1, 1/4-rotation, and center at 0.3/0.3
lines(f_ellipse(0.3, 0.3, 0.2, 0.1, pi / 4)(thetas))
# ellipse with radii 0.2 and 0.1, -1/4-rotation, and center at -0.3/0.3
lines(f_ellipse(-0.3, 0.3, 0.2, 0.1, -pi / 4)(thetas))
# semi-ellipse with radii 0.25 and 0.5 and center at 0/0
lines(f_ellipse(0, 0, 0.25, 0.5, dir = -1)(seq(0, pi, length = 200)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.