Documentation Center

  • Trial Software
  • Product Updates

plot::hull

Compute the convex hull of a set of points

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

plot::hull(L)

Description

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.

Environment Interactions

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.

Examples

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]

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

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

Parameters

L

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

Return Values

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

Algorithms

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

Was this topic helpful?