Skip to Main Content Skip to Search
Product Documentation

plot::hullcompute the convex hull of a set of points

plot::hull computes the convex hull of a list of points in arbitrary dimension.

→ Examples

Call:

plot::hull(L)

Parameters:

L

a list of points, which are given as lists of real values

Return Value:

a list of simplices of dimension one less than that of the points in L, given as lists of lists of floating point values.

Dependencies:

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.

Details:

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.

Example 1

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]

[[17.58320254, 18.38769696], [3.063130321, 19.89625562]]

plot(plot::PointList2d(l),
     plot::Polygon2d(t) $ t in h,
     Closed, PointSize=2)

MuPAD graphics

Example 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])

MuPAD graphics

Background:

plot::hull uses qhull from the Geometry Center of the University of Minnesota, cf. www.qhull.org.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS