% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rectangle_polygon2d.R
\name{rectangle_polygon2d}
\alias{rectangle_polygon2d}
\title{Rectangle polygon}
\usage{
rectangle_polygon2d(width = 1, height = 1, x = 0, y = 0, theta = degrees(0))
}
\arguments{
\item{width}{Width of the rectangle (default \code{1}).}

\item{height}{Height of the rectangle (default \code{1}).}

\item{x}{X-coordinate of the center (default \code{0}).}

\item{y}{Y-coordinate of the center (default \code{0}).}

\item{theta}{Rotation angle (default \code{degrees(0)}).
Will be coerced by \code{\link[=degrees]{degrees()}}.}
}
\value{
A \link{Polygon2D} object with \verb{$is_convex == TRUE}.
}
\description{
\code{rectangle_polygon2d()} creates a rectangle \link{Polygon2D} object
centered at \verb{(x, y)}.
}
\examples{
# A unit square
p <- rectangle_polygon2d()
p$is_convex
plot(p)

# A rotated rectangle
p2 <- rectangle_polygon2d(width = 2, height = 1, theta = degrees(45))
plot(p2)
}
\seealso{
\code{\link[=isotoxal_2ngon_polygon2d]{isotoxal_2ngon_polygon2d()}} for isotoxal star polygons.
\code{\link[=regular_ngon_polygon2d]{regular_ngon_polygon2d()}} for regular convex polygons.
}
