chull: Convex Hull

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

Find the convex hull of a planar set of points allowing for peeling.

Usage

1
chull(x, y = NULL, peel = 0)

Arguments

x, y

Numeric vectors of equal length or any specification of a set of points as allowed by grDevices::xy.coords()

peel

The number of convex hulls to peel off the set before taking the convex hull of the remaining points

Value

An index vector giving the points in the original set forming the convex hull after peeling

Examples

1
2
3
4
5
z <- complex(real = rnorm(50), imaginary = rnorm(50))
plot(z)
polygon(z[chull(z)])
polygon(z[chull(z, peel = 1)], border = "red")
polygon(z[chull(z, peel = 2)], border = "blue")

BillVenables/WWRGraphics documentation built on Feb. 1, 2021, 12:13 p.m.