inscribeEllipse: Inscribe the maximum ellipse into any arbitrary 2D polygon

View source: R/inscribeEllipse.r

inscribeEllipseR Documentation

Inscribe the maximum ellipse into any arbitrary 2D polygon

Description

Inscribe the maximum ellipse into any arbitrary 2D polygon

Usage

inscribeEllipse(poly, step = 0.3, iters = 999)

Arguments

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

Value

center

center of ellipse

radius.x

x-dim of ellipse

radius.y

y-dim of ellipse

maxarea

area of ellipse

Examples

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) 

zarquon42b/Morpho documentation built on Oct. 25, 2024, 6:04 a.m.