Skip to contents

boxPoints finds the four vertices of a rotated rectangle computed by minAreaRect or fitEllipse.

Usage

boxPoints(rect)

Arguments

rect

A list describing a rotated rectangle as created by minAreaRect and fitEllipse.

Value

A matrix containing the coordinates of the four vertices of the rotated rectangle in the following order: bottom left, top left, top right, and bottom right.

Author

Simon Garnier, garnier@njit.edu

Examples

rect <- minAreaRect(rnorm(100), rnorm(100))
boxPoints(rect)
#>               x          y
#> [1,] -3.6557298 -0.0183014
#> [2,] -0.8363885  3.6563187
#> [3,]  3.4933404  0.3343472
#> [4,]  0.6739991 -3.3402730