View source: R/inscribeEllipse.r
inscribeEllipse | R Documentation |
Inscribe the maximum ellipse into any arbitrary 2D polygon
inscribeEllipse(poly, step = 0.3, iters = 999)
poly |
k x 2 matrix containing ordered coordinates forming the polygon. If outline is not closed, the function will close it. |
step |
stepsize |
iters |
integer: number of iterations to run |
center |
center of ellipse |
radius.x |
x-dim of ellipse |
radius.y |
y-dim of ellipse |
maxarea |
area of ellipse |
require(shapes)
require(DescTools)
poly <- gorf.dat[c(1,6:8,2:5),,1]
## Not run:
myellipse <- inscribeEllipse(poly,iters = 200)
plot(poly,asp=1)
lines(rbind(poly,poly[1,]))
DrawEllipse(x=myellipse$center[1],y=myellipse$center[2],radius.x=myellipse$radius.x,
radius.y = myellipse$radius.y,col="red")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.