FUNCTION REFERENCE

convhull

Convex hull of two- or three-dimensional points.

Convex hull of two- or three-dimensional points.

Syntax

K = convhull(x, y)

Syntax

K = convhull(P)

Syntax

[K, A] = convhull(..., 'simplify', tf)

Syntax

[K, V] = convhull(x, y, z)

For two-dimensional points K lists the hull points counter-clockwise as a closed column, starting at the smallest index. Points on hull edges are kept unless 'simplify' is true. A is the enclosed area. For three-dimensional points (x, y, z or a three-column P) each row of K is one triangle of the hull surface, counter-clockwise seen from outside, and V is the enclosed volume. A flat face is split into triangles on its corners; duplicate points and points on faces or edges are not used.

Example

convhull([0 1 1 0 0.5], [0 0 1 1 0.5])'   % [1 2 3 4 1]

Example

[K, V] = convhull([0 0 0; 1 0 0; 0 1 0; 0 0 1; 0.2 0.2 0.2])   % K = [1 2 4; 1 3 2; 1 4 3; 2 3 4], V = 0.1667

Differences from MATLAB: For three-dimensional points the rows are ordered by their vertex indices and a flat face can be split along other diagonals than MATLAB's. Points on faces and edges are left out with or without 'simplify'. A point closer to a face than about 1e-13 times the largest coordinate counts as on it; points that are coplanar within that distance are refused.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.