inscribeEllipseRot: Inscribe the maximum ellipse into any arbitrary 2D polygon...

View source: R/inscribeEllipse.r

inscribeEllipseRotR Documentation

Inscribe the maximum ellipse into any arbitrary 2D polygon including rotations

Description

Inscribe the maximum ellipse into any arbitrary 2D polygon including rotations

Usage

inscribeEllipseRot(poly, step = 0.3, iters = 999, rotsteps = 45)

Arguments

poly

k x 2 matrix containing ordered coordinates forming the polygon

step

stepsize

iters

integer: number of iterations to run

rotsteps

integer: number rotational steps

Value

center

center of ellipse

radius.x

x-dim of ellipse

radius.y

y-dim of ellipse

maxarea

area of ellipse

theta

angle of optimal rotation

polyRot

k x 2 matrix of cooridnates rotated around barycenter to maximize ellipse area

Examples

require(shapes)
require(DescTools)
poly <- gorf.dat[c(1,6:8,2:5),,1]
## Not run: 
myellipse <- inscribeEllipseRot(poly,iters = 999,rotsteps=10)
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.