 Convex hull algorithms

Algorithms that construct convex hulls of various objects have a broad range of applications in mathematics and computer science, see "Convex hull applications".
In computational geometry, numerous algorithms are proposed for computing the convex hull of a finite set of points, with various computational complexities.
Computing the convex hull means that a nonambiguous and efficient representation of the required convex shape is constructed. The complexity of the corresponding algorithms is usually estimated in terms of n, the number of input points, and h, the number of points on the convex hull.
Contents
Planar case
Consider the general case when the input to the algorithm is a finite unordered set of points on a Cartesian plane. An important special case in which the points are given in the order of traversal of a simple polygon's boundary is described later in a separate subsection.
If not all points are on the same line, then their convex hull is a convex polygon whose vertices are some of the points in the input set. Its most common representation is the list of its vertices ordered along its boundary clockwise or counterclockwise. In some applications it is convenient to represent a convex polygon as an intersection of a set of halfplanes.
Lower bound on computational complexity
For a finite set of points in the plane the lower bound on the computational complexity of finding the convex hull represented as a convex polygon is easily shown to be the same as for sorting using the following reduction. For the set x_{1},...x_{n} numbers to sort consider the set of points of points in the plane. Since they lie on a parabola, which is a monotone curve it is easy to see that the vertices of the convex hull, when traversed along the boundary, produce the sorted order of the numbers x_{1},...x_{n}. Clearly, linear time is required for the described transformation of numbers into points and then extracting their sorted order. Therefore in the general case the convex hull of n points cannot be computed more quickly than sorting.
The standard Ω(n log n) lower bound for sorting is proven in the decision tree model of computing, in which only numerical comparisons but not arithmetic operations can be performed; however, in this model, convex hulls cannot be computed at all. Sorting also requires Ω(n log n) time in the algebraic decision tree model of computation, a model that is more suitable for convex hulls, and in this model convex hulls also require Ω(n log n) time.^{[1]} However, in models of computer arithmetic that allow numbers to be sorted more quickly than O(n log n) time, for instance by using integer sorting algorithms, planar convex hulls can also be computed more quickly: the Graham scan algorithm for convex hulls consists of a single sorting step followed by a linear amount of additional work.
Optimal outputsensitive algorithms
As stated above, the complexity of finding a convex hull as a function the input size n is lower bounded by Ω(n log n). However, the complexity of some convex hull algorithms can be characterized in terms of both input size n and the output size h (the number of points in the hull). Such algorithms are called outputsensitive algorithms. They may be asymptotically more efficient than Θ(n log n) algorithms in cases when h = o(n).
The lower bound on worstcase running time of outputsensitive convex hull algorithms was established to be Ω(n log h) in the planar case.^{[1]} There are several algorithms which attain this optimal time complexity. The earliest one was introduced by Kirkpatrick and Seidel in 1986 (who called it "the ultimate convex hull algorithm"). A much simpler algorithm was developed by Chan in 1996, and is called Chan's algorithm.
Algorithms
Known convex hull algorithms are listed below, ordered by the date of first publication. Time complexity of each algorithm is stated in terms of the number of inputs points n and the number of points on the hull h. Note that in the worst case h may be as large as n.
 Gift wrapping aka Jarvis march — O(nh)
One of the simplest (although not the most time efficient in the worst case) planar algorithms. Discovered independently by Chand & Kapur in 1970 and R. A. Jarvis in 1973. It has O(nh) time complexity, where n is the number of points in the set, and h is the number of points in the hull. In the worst case the complexity is Θ(n^{2}).
 Graham scan — O(n log n)
A slightly more sophisticated, but much more efficient algorithm, published by Ronald Graham in 1972. If the points are already sorted by one of the coordinates or by the angle to a fixed vector, then the algorithm takes O(n) time.
 QuickHull
Discovered independently in 1977 by W. Eddy and in 1978 by A. Bykat. Just like the quicksort algorithm, it has the expected time complexity of O(n log n), but may degenerate to Θ(nh) = O(n^{2}) in the worst case.
 Divide and conquer — O(n log n)
Another O(n log n) algorithm, published in 1977 by Preparata and Hong. This algorithm is also applicable to the three dimensional case.
 Monotone chain — O(n log n)
Published in 1979 by A. M. Andrew. The algorithm can be seen as a variant of Graham scan which sorts the points lexicographically by their coordinates. When the input is already sorted, the algorithm takes O(n) time.
 Incremental convex hull algorithm — O(n log n)
Published in 1984 by Michael Kallay.
 Marriagebeforeconquest — O(n log h)
The first optimal outputsensitive algorithm. Published by Kirkpatrick and Seidel in 1986.
 Chan's algorithm — O(n log h)
A simpler optimal outputsensitive algorithm discovered by Chan in 1996.
AklToussaint heuristic
The following simple heuristic is often used as the first step in implementations of convex hull algorithms to improve their performance. It is based on the efficient convex hull algorithm by Selim Akl and G. T. Toussaint, 1978. The idea is to quickly exclude many points that would not be part of the convex hull anyway. This method is based on the following idea. Find the two points with the lowest and highest xcoordinates, and the two points with the lowest and highest ycoordinates. (Each of these operations takes O(n).) These four points form a convex quadrilateral, and all points that lie in this quadrilateral (except for the four initially chosen vertices) are not part of the convex hull. Finding all of these points that lie in this quadrilateral is also O(n), and thus, the entire operation is O(n). Optionally, the points with smallest and largest sums of x and ycoordinates as well as those with smallest and largest differences of x and ycoordinates can also be added to the quadrilateral, thus forming an irregular convex octagon, whose insides can be safely discarded. If the points are random variables, then for a wide class of probability density functions, this throwaway preprocessing step will make a convex hull algorithm run in linear expected time, even if the worstcase complexity of the convex hull algorithm is quadratic in n.^{[2]}
Online and dynamic convex hull problems
The discussion above considers the case when all input points are known in advance. One may consider two other settings.^{[1]}
 Online convex hull problem: Input points are obtained sequentially one by one. After each point arrives on input, the convex hull for the pointset obtained so far must be efficiently computed.
 Dynamic convex hull maintenance: The input points may be sequentially inserted or deleted, and the convex hull must be updated after each insert/delete operation.
Insertion of a point may increase the number of vertices of a convex hull at most by 1, while deletion may convert a 3vertex convex hull into an n1vertex one.
The online version may be handled with O(log n) per point, which is asymptotically optimal. The dynamic version may be handled with O(log^{2} n) per operation.^{[1]}
Simple polygon
McCallum and Avis were first to provide a correct algorithm to construct the convex hull of a simple polygon v_{1},...,v_{n} in O(n) time. The basic idea is very simple. The leftmost vertex is on the convex hull and we denote it h_{1}. The second point is assumed to be a candidate convex hull vertex as well. At each step one looks at three consecutive vertices of the polygon, with two first ones tentatively assigned to the growing convex hull and the third one is a new unprocessed vertex of the polygon, say, we denote this as h_{k − 1},h_{k},v_{i}. If the angle is convex, then h_{k + 1} = v_{i} and the whole triple is shifted by one vertex along the polygon. If the resulting angle is concave, then the middle point (h_{k}) is deleted and the test is repeated for the triple h_{k − 2},h_{k − 1},v_{i}, etc. until we backtrack either to a convex angle or to point h_{1}. After that the next (along the polygon) vertex is added to the triple to be tested, and the process repeats. However several previously published articles overlooked a possibility that deletion of a vertex from a polygon may result in a selfintersecting polygon, rendering further flow of the algorithm invalid. Fortunately, this case may also be handled efficiently. Later Tor and Middleditch (1984, "Convex Decomposition of Simple Polygons") and independently Melkman (1985, "Online Construction of the convex hull of a simple polyline") suggested a simpler approach with the same time complexity.
Higher dimensions
A number of algorithms are known for the threedimensional case, as well as for arbitrary dimensions. See http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html. See also David Mount's Lecture Notes for comparison. Refer to Lecture 4 for the latest developments, including Chan's algorithm.
For a finite set of points, the convex hull is a convex polyhedron in three dimensions, or in general a convex polytope for any number of dimensions, whose vertices are some of the points in the input set. Its representation is not so simple as in the planar case, however. In higher dimensions, even if the vertices of a convex polytope are known, construction of its faces is a nontrivial task, as is the dual problem of constructing the vertices given the faces. The size of the output may be exponentially larger than the size of the input, and even in cases where the input and output are both of comparable size the known algorithms for highdimensional convex hulls are not outputsensitive due both to issues with degenerate inputs and with intermediate results of high complexity.^{[3]}
See also
References
 ^ ^{a} ^{b} ^{c} ^{d} Preparata, Shamos, Computational Geometry, Chapter "Convex Hulls: Basic Algorithms"
 ^ Luc Devroye and Godfried Toussaint, "A note on linear expected time algorithms for finding convex hulls," Computing, Vol. 26, 1981, pp. 361366.
 ^ Avis, David; Bremner, David; Seidel, Raimund (1997), "How good are convex hull algorithms?", Computational Geometry: Theory and Applications 7 (56): 265–301, doi:10.1016/S09257721(96)000235.
Further reading
 Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, Second Edition. MIT Press and McGrawHill, 2001. ISBN 0262032937. Section 33.3: Finding the convex hull, pp. 947–957.
 Franco P. Preparata, S.J. Hong. Convex Hulls of Finite Sets of Points in Two and Three Dimensions, Commun. ACM, vol. 20, no. 2, pp. 87–93, 1977.
 Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf (2000). Computational Geometry (2nd revised edition ed.). SpringerVerlag. ISBN 3540656200. Section 1.1: An Example: Convex Hulls (describes classical algorithms for 2dimensional convex hulls). Chapter 11: Convex Hulls: pp. 235–250 (describes a randomized algorithm for 3dimensional convex hulls due to Clarkson and Shor).
External links
 Weisstein, Eric W., "Convex Hull" from MathWorld.
 2D, 3D, and dD Convex Hull in CGAL, the Computational Geometry Algorithms Library
 Qhull code for Convex Hull, Delaunay Triangulation, Voronoi Diagram, and Halfspace Intersection
 Demo as Flash swf, Jarvis, Graham, Quick (divide and conquer) and Chan algorithms
Categories:  Gift wrapping aka Jarvis march — O(nh)
Wikimedia Foundation. 2010.
Look at other dictionaries:
Convex hull — The convex hull of the red set is the blue convex set. See also: Convex set and Convex combination In mathematics, the convex hull or convex envelope for a set of points X in a real vector space V is the min … Wikipedia
Dynamic convex hull — The dynamic convex hull problem is a class of dynamic problems in computational geometry. The problem consists in the maintenance, i.e., keeping track, of the convex hull for the dynamically changing input data, i.e., when input data elements may … Wikipedia
Orthogonal convex hull — The orthogonal convex hull of a point set In Euclidean geometry, a set is defined to be orthogonally convex if, for every line L that is parallel to one of the axes of the Cartesian coordinate system, the intersection of K with L is empty, a… … Wikipedia
Convex polytope — A 3 dimensional convex polytope A convex polytope is a special case of a polytope, having the additional property that it is also a convex set of points in the n dimensional space Rn.[1] Some authors use the terms convex polytope and convex… … Wikipedia
List of algorithms — The following is a list of the algorithms described in Wikipedia. See also the list of data structures, list of algorithm general topics and list of terms relating to algorithms and data structures.If you intend to describe a new algorithm,… … Wikipedia
Minimum bounding box algorithms — In computational geometry, the smallest enclosing box problem is that of finding the oriented minimum bounding box enclosing a set of points. It is a type of bounding volume. Smallest may refer to volume, area, perimeter, etc. of the box. It is… … Wikipedia
Outputsensitive algorithm — In computer science, an output sensitive algorithm is an algorithm whose running time depends not only on the size of the input but also on the size of the output. For certain problems where the output size varies widely, for example from linear… … Wikipedia
Chan's algorithm — In computational geometry, Chan s algorithm, named after Timothy M. Chan, is an optimal output sensitive algorithm to compute the convex hull of a set P of n points, in 2 or 3 dimensional space. The algorithm takes O(n log h) time, where h is the … Wikipedia
Gift wrapping algorithm — The gift wrapping algorithm is a simple algorithm for computing the convex hull of a given set of points. Planar case In the two dimensional case the algorithm is also known as Jarvis march, after R. A. Jarvis, who published it in 1973; it has O( … Wikipedia
List of mathematics articles (C) — NOTOC C C closed subgroup C minimal theory C normal subgroup C number C semiring C space C symmetry C* algebra C0 semigroup CA group Cabal (set theory) Cabibbo Kobayashi Maskawa matrix Cabinet projection Cable knot Cabri Geometry Cabtaxi number… … Wikipedia