octave: Convex Hull
30.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.
-- : H = convhull (X, Y)
-- : H = convhull (X, Y, OPTIONS)
Compute the convex hull of the set of points defined by the arrays
X and Y. The hull H is an index vector into the set of points and
specifies which points form the enclosing hull.
An optional third argument, which must be a string or cell array of
strings, contains options passed to the underlying qhull command.
See the documentation for the Qhull library for details
<http://www.qhull.org/html/qh-quick.htm#options>. The default
option is ‘{"Qt"}’.
If OPTIONS is not present or ‘[]’ then the default arguments are
used. Otherwise, OPTIONS replaces the default argument list. To
append user options to the defaults it is necessary to repeat the
default arguments in OPTIONS. Use a null string to pass no
arguments.
DONTPRINTYET See also: convhulln XREFconvhulln, *notedelaunay:
DONTPRINTYET See also: convhulln XREFconvhulln, delaunay
XREFdelaunay, voronoi XREFvoronoi.
-- : H = convhulln (PTS)
-- : H = convhulln (PTS, OPTIONS)
-- : [H, V] = convhulln (...)
Compute the convex hull of the set of points PTS.
PTS is a matrix of size [n, dim] containing n points in a space of
dimension dim.
The hull H is an index vector into the set of points and specifies
which points form the enclosing hull.
An optional second argument, which must be a string or cell array
of strings, contains options passed to the underlying qhull
command. See the documentation for the Qhull library for details
<http://www.qhull.org/html/qh-quick.htm#options>. The default
options depend on the dimension of the input:
• 2D, 3D, 4D: OPTIONS = ‘{"Qt"}’
• 5D and higher: OPTIONS = ‘{"Qt", "Qx"}’
If OPTIONS is not present or ‘[]’ then the default arguments are
used. Otherwise, OPTIONS replaces the default argument list. To
append user options to the defaults it is necessary to repeat the
default arguments in OPTIONS. Use a null string to pass no
arguments.
If the second output V is requested the volume of the enclosing
convex hull is calculated.
DONTPRINTYET See also: convhull XREFconvhull, *notedelaunayn:
DONTPRINTYET See also: convhull XREFconvhull, delaunayn
XREFdelaunayn, voronoin XREFvoronoin.
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]);