Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# convhull

### Note

Qhull-specific options are no longer supported. Remove the `OPTIONS` argument from all instances in your code that pass it to `convhull`.

## Syntax

```K = convhull(X,Y) K = convhull(X,Y,Z) K = convhull(X) K = convhull(...,'simplify', logicalvar) [K,V] = convhull(...) ```

## Description

`K = convhull(X,Y)` returns the 2-D convex hull of the points (`X`,`Y`), where `X` and `Y` are column vectors. The convex hull `K` is expressed in terms of a vector of point indices arranged in a counterclockwise cycle around the hull.

`K = convhull(X,Y,Z)` returns the 3-D convex hull of the points (`X`,`Y`,`Z`), where `X`, `Y`, and `Z` are column vectors. `K` is a triangulation representing the boundary of the convex hull. `K` is of size `mtri`-by-3, where `mtri` is the number of triangular facets. That is, each row of `K` is a triangle defined in terms of the point indices.

`K = convhull(X)` returns the 2-D or 3-D convex hull of the points `X`. This variant supports the definition of points in matrix format. `X` is of size `mpts`-by-`ndim`, where `mpts` is the number of points and `ndim` is the dimension of the space where the points reside, 2 ≦ `ndim` ≦ 3. The output facets are equivalent to those generated by the 2-input or 3-input calling syntax.

`K = convhull(...,'simplify', logicalvar)` provides the option of removing vertices that do not contribute to the area/volume of the convex hull, the default is false. Setting `'simplify'` to true returns the topology in a more concise form.

`[K,V] = convhull(...)` returns the convex hull `K` and the corresponding area/volume `V` bounded by `K`.

## Visualization

Use `plot` to plot the output of `convhull` in 2-D. Use `trisurf` or `trimesh` to plot the output of convhull in 3-D.

## Examples

collapse all

```xx = -1:.05:1; yy = abs(sqrt(xx)); [x,y] = pol2cart(xx,yy); k = convhull(x,y); plot(x(k),y(k),'r-',x,y,'b*')``` collapse all

### Convex Hull

`convhull` returns the convex hull of a set of points in 2-D or 3-D space.