Next: Interpolation on Scattered Data, Previous: Voronoi Diagrams, Up: Geometry

### 29.3 Convex Hull

The convex hull of a set of points is the minimum convex envelope containing all of the points. Octave has the functions `convhull` and `convhulln` to calculate the convex hull of 2-dimensional and N-dimensional sets of points.

— Function File: H = convhull (x, y)
— Function File: H = convhull (x, y, opt)

> Returns the index vector to the points of the enclosing convex hull. The data points are defined by the x and y vectors.

> A third optional argument, which must be a string, contains extra options passed to the underlying qhull command. See the documentation for the Qhull library for details.

> See also: delaunay, convhulln.

— Loadable Function: H = convhulln (p)
— Loadable Function: H = convhulln (p, opt)

> Returns an index vector to the points of the enclosing convex hull. The input matrix of size [n, dim] contains n points of dimension dim.

> If a second optional argument is given, it must be a string or cell array of strings containing options for the underlying qhull command. (See the Qhull documentation for the available options.) The default options are "s Qci Tcv".

> See also: convhull, delaunayn.

An example of the use of `convhull` is

         x = -3:0.05:3;
         y = abs (sin (x));
         k = convhull (x, y);
         plot (x(k), y(k), "r-", x, y, "b+");
         axis ([-3.05, 3.05, -0.05, 1.05]);