# convhulln: Compute smallest convex hull that encloses a set of points In geometry: Mesh Generation and Surface Tesselation

## Description

Returns an index matrix to the points of simplices (“triangles”) that form the smallest convex simplicial complex of a set of input points in N-dimensional space. This function interfaces the Qhull library.

## Usage

 `1` ```convhulln(p, options = "Tv") ```

## Arguments

 `p` An `n`-by-`dim` matrix. The rows of `p` represent `n` points in `dim`-dimensional space. `options` String containing extra options for the underlying Qhull command; see details below and Qhull documentation at http://www.qhull.org/html/qconvex.htm#synopsis.

## Details

For slient operation, specify the option `Pp`.

## Value

An `m`-by-`dim` index matrix of which each row defines a `dim`-dimensional “triangle”. The indices refer to the rows in `p`. If the option `FA` is provided, then the output is a `list` with entries `hull` containing the matrix mentioned above, and `area` and `vol` with the generalised area and volume of the hull described by the matrix. When applying convhulln to a 3D object, these have the conventional meanings: `vol` is the volume of enclosed by the hull and `area` is the total area of the facets comprising the hull's surface. However, in 2D the facets of the hull are the lines of the perimeter. Thus `area` is the length of the perimeter and `vol` is the area enclosed.

## Note

This is a port of the Octave's (http://www.octave.org) geometry library. The Octave source was written by Kai Habel.

See further notes in `delaunayn`.

## Author(s)

Raoul Grasman, Robert B. Gramacy and David Sterratt [email protected]

## References

Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., “The Quickhull algorithm for convex hulls,” ACM Trans. on Mathematical Software, Dec 1996.

`convex.hull`, `delaunayn`, `surf.tri`, `distmesh2d`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```# example convhulln # ==> see also surf.tri to avoid unwanted messages printed to the console by qhull ps <- matrix(rnorm(3000), ncol=3) # generate points on a sphere ps <- sqrt(3)*ps/drop(sqrt((ps^2) %*% rep(1, 3))) ts.surf <- t(convhulln(ps)) # see the qhull documentations for the options ## Not run: rgl.triangles(ps[ts.surf,1],ps[ts.surf,2],ps[ts.surf,3],col="blue",alpha=.2) for(i in 1:(8*360)) rgl.viewpoint(i/8) ## End(Not run) ```