% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coord-methods.R
\name{convex_hull2d}
\alias{convex_hull2d}
\alias{convex_hull2d.Coord2D}
\alias{convex_hull2d.Polygon2D}
\title{Compute 2D convex hulls}
\usage{
convex_hull2d(x, ...)

\method{convex_hull2d}{Coord2D}(x, ...)

\method{convex_hull2d}{Polygon2D}(x, ...)
}
\arguments{
\item{x}{An object to compute the convex hull of,
such as a \link{Coord2D} or \link{Polygon2D} object.}

\item{...}{Further arguments passed to or from other methods.}
}
\value{
A \link{Polygon2D} object representing the convex hull.
}
\description{
\code{convex_hull2d()} is a S3 generic for computing the convex hull of an
object.  It is implemented for \link{Coord2D} and \link{Polygon2D} objects using
\code{\link[grDevices:chull]{grDevices::chull()}} and returns a \link{Polygon2D} whose vertices are in
counter-clockwise order.
}
\examples{
pts <- as_coord2d(x = rnorm(20), y = rnorm(20))
hull <- convex_hull2d(pts)
is_polygon2d(hull)
hull$is_convex
plot(hull)
points(pts)
}
