find convex hull enclosing the given points
list or set of points in 2 dimensions
The command convexhull(P) returns a list of points defining the convex hull of the points in P in counter-clockwise order.
Every point in P must be a list of an x and y coordinate, both of which must be numbers (of type numeric).
If the option output=area is specified, the area of the convex hull of the points is returned.
If the option output=hull is specified, the convex hull is is returned as a list of points. This is the default return value.
If the option output=plot is specified, a plot of the points and the convex hull is returned.
Multiple outputs can be specified, for example, output=[hull,area] returns a sequence of two values.
An n⁢log⁡n algorithm computing tangents of pairs of points is used.
For a slightly more geometrical interpretation of the same command, see geometry[convexhull]. The points input and output are geometric points, and the output is considered to be a convex polygon.
The command with(simplex,convexhull) allows the use of the abbreviated form of this command.
P ≔ 0,0,12,12,1,1,2,0,1,0,1,12
H,A ≔ convexhull⁡P,output=hull,area
Execute the following to get a plot of the points and the convex hull.
This creates 50 points uniformly distributed at random on [0,1).
R ≔ rand⁡1010:
U01 := proc() Float( R(), -10 ) end proc:
P ≔ seq⁡U01⁡,U01⁡,i=1..50:
Download Help Document
What kind of issue would you like to report? (Optional)