Learn R Programming

Rvision (version 0.6.0)

minAreaRect: Fit a Rectangle Around a Set of 2D Points

Description

minAreaRect calculates the minimum area enclosing rectangle that fits a set of 2D points.

Usage

minAreaRect(x, y)

Arguments

x

A vector of x coordinates.

y

A vector of y coordinates of the same lenght as x.

Value

A list containing the height and width (in pixels) of the ellipse, the angle (in degrees) of its main axis with respect to the x axis, and the x and y coordinates of its center.

See Also

fitEllipse

Examples

Run this code
# NOT RUN {
minAreaRect(rnorm(100), rnorm(100))

# }

Run the code above in your browser using DataLab