convexHull

Class: DelaunayTri

(Will be removed) Convex hull

Syntax

K = convexHull(DT)
[K AV] = convexHull(DT)

Description

K = convexHull(DT) returns the indices into the array of points DT.X that correspond to the vertices of the convex hull.

[K AV] = convexHull(DT) returns the convex hull and the area or volume bounded by the convex hull.

Input Arguments

DTDelaunay triangulation.

Output Arguments

KIf the points lie in 2-D space, K is a column vector of length numf. Otherwise K is a matrix of size numf-by-ndim, numf being the number of facets in the convex hull, and ndim the dimension of the space where the points reside.
AVThe area or volume of the convex hull.

Definitions

The convex hull of a set of points X is the smallest convex region containing all of the points of X.

Examples

Example 1

Compute the convex hull of a set of random points located within a unit square in 2-D space.

x = rand(10,1)
y = rand(10,1)
dt = DelaunayTri(x,y)
k = convexHull(dt)
plot(dt.X(:,1),dt.X(:,2), '.', 'markersize',10); hold on;
plot(dt.X(k,1),dt.X(k,2), 'r'); hold off;

Example 2

Compute the convex hull of a set of random points located within a unit cube in 3-D space, and the volume bounded by the convex hull.

X = rand(25,3)
dt = DelaunayTri(X)
[ch v] = convexHull(dt)
trisurf(ch, dt.X(:,1),dt.X(:,2),dt.X(:,3), 'FaceColor', 'cyan')

Was this topic helpful?