# chull

##### Compute Convex Hull of a Set of Points

Computes the subset of points which lie on the convex hull of the set of points specified.

- Keywords
- graphs

##### Usage

`chull(x, y = NULL)`

##### Arguments

- x, y
coordinate vectors of points. This can be specified as two vectors

`x`

and`y`

, a 2-column matrix`x`

, a list`x`

with two components, etc, see`xy.coords`

.

##### Details

`xy.coords`

is used to interpret the specification of the
points. Infinite, missing and `NaN`

values are not allowed.

The algorithm is that given by Eddy (1977).

##### Value

An integer vector giving the indices of the unique points lying on the convex hull, in clockwise order. (The first will be returned for duplicate points.)

##### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988).
*The New S Language*.
Wadsworth & Brooks/Cole.

Eddy, W. F. (1977).
A new convex hull algorithm for planar sets.
*ACM Transactions on Mathematical Software*, **3**, 398--403.
10.1145/355759.355766.

Eddy, W. F. (1977).
Algorithm 523: CONVEX, A new convex hull algorithm for planar sets [Z].
*ACM Transactions on Mathematical Software*, **3**, 411--412.
10.1145/355759.355768.

##### See Also

##### Examples

`library(grDevices)`

```
# NOT RUN {
X <- matrix(stats::rnorm(2000), ncol = 2)
chull(X)
# }
# NOT RUN {
# Example usage from graphics package
plot(X, cex = 0.5)
hpts <- chull(X)
hpts <- c(hpts, hpts[1])
lines(X[hpts, ])
# }
```

*Documentation reproduced from package grDevices, version 3.5.1, License: Part of R 3.5.1*