Learn R Programming

PlaneGeometry (version 1.1.0)

LownerJohnEllipse: L<U+00F6>wner-John ellipse (ellipse hull)

Description

Minimum area ellipse containing a set of points.

Usage

LownerJohnEllipse(pts)

Arguments

pts

the points in a two-columns matrix (one point per row); at least three distinct points

Value

An Ellipse object.

Examples

Run this code
# NOT RUN {
pts <- cbind(rnorm(30, sd=2), rnorm(30))
ell <- LownerJohnEllipse(pts)
box <- ell$boundingbox()
plot(NULL, asp = 1, xlim = box$x, ylim = box$y, xlab = NA, ylab = NA)
draw(ell, col = "seaShell")
points(pts, pch = 19)
all(apply(pts, 1, ell$contains)) # should be TRUE
# }

Run the code above in your browser using DataLab