Skip to contents

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

Author

Simon Garnier, garnier@njit.edu

Examples

minAreaRect(rnorm(100), rnorm(100))
#> $angle
#> [1] 9.195665
#> 
#> $height
#> [1] 4.968313
#> 
#> $width
#> [1] 4.189914
#> 
#> $center
#> [1] 0.08377385 0.24417567
#>