Compute the convex hull of a set of points
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
plot::hull(L
)
plot::hull
computes the convex hull of a
list of points in any dimension, i.e., the smallest convex region
containing all the points. Such a region is bounded by simplices (straight
lines in the plane, triangles in 3D) and it is these simplices which plot::hull
returns.
Although plot::hull
accepts and returns floating
point values, the actual computations take place in hardware floating
points and are therefore not affected by the
value of DIGITS
.
We generate a list of random points and compute their convex hull:
X := stats::uniformRandom(0, 20): l := [[X(), X()] $ i = 1..10]: h := plot::hull(l):
The convex hull is returned as lists of lists, as accepted by plot::Polygon2d
:
h[1]
plot(plot::PointList2d(l), plot::Polygon2d(t) $ t in h, Closed, PointSize=2)
The convex hull of a list of points in 3D is also easy to visualize:
l := [[x, y, z] $ y = z..x $ z = x..x $ x = 0..10]: h := plot::hull(l): plot(plot::PointList3d(l, PointSize=1), plot::Polygon3d(t) $ t in h, Closed, Filled, FillColor=RGB::LightOrange.[0.6])

A list of points, which are given as lists of real values 
List of simplices of dimension one less than that of the points
in L
, given as lists of lists of floatingpoint
values.
plot::hull
uses qhull from the Geometry Center
of the University of Minnesota, see www.qhull.org.