.BG
.FN chull
.TL
Convex Hull of a Planar Set of Points
.CS
chull(x, y, peel=FALSE, maxpeel,
      onbdy=peel, tol=.0001)
.XY
.AG peel
should successive convex hulls be peeled from
the remaining points, generating a nested set of hulls?
.AG maxpeel
maximum number of hulls that should be peeled from the data,
default is to peel until all points are assigned to a hull.
If `maxpeel' is given, it implies `peel=TRUE'.
.AG onbdy
should points on the boundary of a convex hull (but
not vertices of the hull) be included in the hull?
.AG tol
relative tolerance for determining inclusion on hull.
.RT
vector giving the indices of the points on the hull.  If
`peel' is `TRUE', returns a data structure with components
`depth', `hull' and `count'.
.RC depth
a vector which assigns a depth to each point, i.e., the
number of hulls surrounding the point.  Outliers will have
small values of `depth', interior points relatively large
values.
.RC hull
vector giving indices of the points on the hull.  Along with
`count', determines all of the hull peels.  The first
`count[1]' values of `hull' determine the outermost hull,
the next  `count[2]' are the second hull, etc.
.RC count
counts of the number of points on successive hulls.
.EX
hull <- chull(x,y)
plot(x,y)
polygon(x[hull],y[hull])  # draw hull

p <- chull(x, y, peel=T)   # all hulls
which <- rep(seq(p$count), p$count)   # which peel for each pt
s <- split(p$hull, which)
for(i in seq(s)) {     # plot all peels
      j <- s[[i]]    # indices of points on ith peel
      if(length(j)>2)
	      polygon(x[j], y[j], lty=i)
}
.KW dplot
.WR
