(Technical Report 1993) The Quickhull Algorithm For Convex Hull
(Technical Report 1993) The Quickhull Algorithm For Convex Hull
net/publication/242414606
CITATIONS READS
2,779 5,499
3 authors, including:
Hannu Huhdanpaa
University of Southern California
12 PUBLICATIONS 5,825 CITATIONS
SEE PROFILE
All content following this page was uploaded by Hannu Huhdanpaa on 19 February 2015.
The convex hull of a set of points is the smallest convex set that contains the points. This
article presents a practical convex hull algorithm that combines the two-dimensional Quick-
hull Algorithm with the general-dimension Beneath-Beyond Algorithm. It is similar to the
randomized, incremental algorithms for convex hull and Delaunay triangulation. We provide
empirical evidence that the algorithm runs faster when the input contains nonextreme points
and that it uses less memory. Computational geometry algorithms have traditionally assumed
that input sets are well behaved. When an algorithm is implemented with floating-point
arithmetic, this assumption can lead to serious errors. We briefly describe a solution to this
problem when computing the convex hull in two, three, or four dimensions. The output is a set
of “thick” facets that contain all possible exact convex hulls of the input. A variation is
effective in five or more dimensions.
Categories and Subject Descriptors: I.3.5 [Computer Graphics]: Computational Geometry
and Object Modeling—geometric algorithms, languages, and systems
General Terms: Algorithms, Reliability
Additional Key Words and Phrases: Convex hull, Delaunay triangulation, halfspace intersec-
tion, Voronoi diagram
1. INTRODUCTION
The convex hull of a set of points is the smallest convex set that contains
the points. The convex hull is a fundamental construction for mathematics
This research was supported in part by the National Science Foundation under grants
NSF-CCR-91-15793 750-7504, NSF/DMS-8920161, CCR90-02352, and CCR-93-01254.
Authors’ addresses: C. B. Barber, The Geometry Center, University of Minnesota, 1300 South
Second Street, Minneapolis, MN 55454; email: [email protected]; D. P. Dobkin, Department of
Computer Science, Princeton University, Princeton, NJ 08544; email: [email protected];
H. Huhdanpaa, Configured Energy Systems, Inc., 3140 Harbor Lane North, Suite 202,
Plymouth, MN 55447; email: [email protected].
Permission to make digital / hard copy of part or all of this work for personal or classroom use
is granted without fee provided that the copies are not made or distributed for profit or
commercial advantage, the copyright notice, the title of the publication, and its date appear,
and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to
republish, to post on servers, or to redistribute to lists, requires prior specific permission
and / or a fee.
© 1996 ACM 0098-3500/96/1200 –0469 $03.50
ACM Transactions on Mathematical Software, Vol. 22, No. 4, December 1996, Pages 469 –483.
470 • C. Bradford Barber et al.
maintain the list of polytope edges that intersect the halfspace. The conflict
graph is the set of all such lists. When a halfspace is processed, the conflict
graph identifies the modified edges. To reduce memory requirements to
O(n), they propose storing a single modified edge for each unprocessed
halfspace. A simple search of adjacent edges identifies the remaining
modified edges.
Our Quickhull Algorithm is a variation of Clarkson and Shor’s algorithm.
As with most of the variations, we work in the space of points and convex
hulls instead of the dual space of halfspaces and polytopes. This turns the
conflict graph into an outside set for each facet. A point is in a facet’s
outside set only if it is above the facet. As in Clarkson and Shor’s
algorithm, an unprocessed point is in exactly one outside set. Our variation
is to process the furthest point of an outside set instead of a random point.
In R2, this is the well-known Quickhull Algorithm [Bykat 1978; Eddy 1977;
Green and Silverman 1979; Preparata and Shamos 1985].
Other variations of Clarkson and Shor’s algorithm do not maintain
conflict graphs or outside sets. Instead, they retain old facets of the convex
hull with links to the new facets that replaced them. This hierarchy begins
with an initial simplex formed from d 1 1 of the input points. The
algorithms find a visible facet for a point by searching for a chain of visible
facets through the hierarchy. The chain either ends with a facet of the
current hull, or all facets of the current hull are above the point; and the
point is then discarded. These algorithms have been implemented, and
their running times are competitive with other algorithms [Fortune 1993].
We can compare Quickhull with the randomized incremental algorithms
by changing the selection step of Quickhull. If Quickhull selects a random
point instead of a furthest point, it is a randomized incremental algorithm.
In our empirical tests, Quickhull runs faster than the randomized algo-
rithms because it processes fewer interior points. Also, Quickhull reuses
the memory occupied by old facets.
Our analysis is strictly empirical. We define two balance conditions that
would guarantee behavior identical to the randomized algorithms when all
points are extreme. If the balance conditions hold, our algorithm runs on an
input of size n with r processed points in time O(n log r) for d # 3 and
O(nfr/r) for d $ 4 (fr is the maximum number of facets for r vertices). We
conjecture that this is always the case when the input precision is re-
stricted to O(log n) bits.
Empirically, the number of points processed by Quickhull is proportional
to the number of vertices in the output. Output sensitivity is important for
convex hull algorithms because the output size can be much smaller than
the worst-case size. In R2, Kirkpatrick and Seidel [1986] found an optimal
output-sensitive algorithm for the convex hull that runs in O(n log h) time,
where h is the output size. Clarkson and Shor [1989] give a 3D convex-hull
algorithm with optimal output-sensitive expected time; it was derandom-
ized by Chazelle and Matous̆ek [1992]. In higher dimensions, the best
output-sensitive algorithm is Seidel’s shelling algorithm at O(n2 1 h log n)
when h 5 V(n) [Seidel 1986], and gift-wrapping at O(nh) otherwise [Chand
ACM Transactions on Mathematical Software, Vol. 22, No. 4, December 1996.
472 • C. Bradford Barber et al.
only if
(1) F is a facet of H, and p is below F; or
(2) F is not a facet of H, and its vertices are p and the vertices of a ridge of
H with one incident facet below p and the other incident facet above p.
The central problem of Beneath-Beyond is determining the visible facets
efficiently. Since a facet is linked to its neighbors, locating one visible facet
allows the rest to be located quickly. Most of the randomized algorithms
use the previously constructed facets to locate the first visible facet for a
point. Our solution is simpler. After initialization, Quickhull assigns each
unprocessed point to an outside set. By definition, the corresponding facet
is visible from the point.
When Quickhull creates a cone of new facets, it builds new outside sets
from the outside sets of the visible facets. This process, called partitioning,
locates a visible new facet for each point. If a point is above multiple new
facets, one of the new facets is selected. If it is below all of the new facets,
the point is inside the convex hull and can be discarded. Partitioning also
records the furthest point of each outside set.
ACM Transactions on Mathematical Software, Vol. 22, No. 4, December 1996.
The Quickhull Algorithm for Convex Hulls • 473
LEMMA 2.2. If an extreme point of the input is above two or more facets at
a partition step in Quickhull, it will be added to the hull irrespective of
which outside set it is assigned to.
THEOREM 2.3. The Quickhull Algorithm produces the convex hull of a set
of points in Rd.
in Part (2). It produces the convex hull of the processed points. Processing
the last point produces the convex hull of the input set. e
Most of the randomized incremental algorithms perform the same steps
as Quickhull, but in a different order. They use Beneath-Beyond on a
random permutation of the points. They locate a visible facet by a depth-
first search of the previous convex hulls. Consider the sequence of facets
tested for a point. Quickhull may test the same sequence during successive
partitions of the point into outside sets.
Edelsbrunner and Shah [1992], Joe [1991], and Boissonnat and Devillers-
Teillaud [1993] use a similar method for Delaunay triangulations. They
express their algorithm in terms of triangulations and the in-sphere test.
By the correspondence between Delaunay triangulation and convex hull,
each triangle is a facet of the convex hull, and the in-sphere test deter-
mines the visible facets for the lifted point [Brown 1979].
Fig. 2. Convex hull of uniformly distributed 3D points. Average and range for hyperplanes
created over 10 trials.
Fig. 3. Convex hull of uniformly distributed 3D points. Average and range for distance tests
over 10 trials.
Fig. 4. Convex hull of uniformly distributed 3D points. Average and range for processed
points and output vertices over 10 trials.
first case occurs when the points of a spiral happen to be added in order.
This cannot occur for Quickhull because the end of the spiral would be
added before most of the intermediate points.
ACM Transactions on Mathematical Software, Vol. 22, No. 4, December 1996.
The Quickhull Algorithm for Convex Hulls • 477
For Quickhull, the second case corresponds to assigning all points to one
outside set for most partitions. We conjecture that this cannot occur if we
restrict the input precision to O(log n) bits (personal communication, V.
Milenkovic, 1994). In Rd, a point creates at least d new facets. Since
Quickhull processes the furthest point of each outside set, a sequence of
partitions to a single facet would produce a facet that is too small for the
input precision. A similar restriction holds for Quicksort using a mean
pivot. For Quicksort to be unbalanced, most of the points must consistently
fall in one of two partitions. With a mean pivot, this would require O(n) bits
of precision.
We conjecture that Quickhull iterations are average (i.e., each iteration
creates an average number of new facets whose outside sets are average
size). This defines two balance conditions. Let d be the dimension, n the
number of input points, r the number of processed points, and fr the
maximum number of facets of r vertices (fr 5 O(r d/2/ d/2!) [Klee 1966]).
Fig. 5. Five erroneous facets when F1 and F3 are visible from P but not F2. The erroneous
facets are built from ridges a– e.
For Quickhull, the furthest point of an outside set is not always the
furthest point from a facet, but in many cases, it is the furthest overall and
hence an extreme point. If it is not an extreme point, then a later point will
delete it. An extreme point that deletes multiple vertices appears to occur
infrequently. For these reasons, we make the following conjecture.
Conjecture 3.3. Let n be the number of input points in Rd and v be the
number of output vertices. If the precision of the input points is O(log n),
the worst-case complexity of Quickhull is O(n log v) for d # 3 and O(n fv/v)
for d $ 4.
distant from the precise convex hull. Later, the coplanar point may be far
above a new facet. If this occurs, Quickhull generates a warning and
reports a wide facet.
In R2, there are several robust convex hull and Delaunay triangulation
algorithms [Fortune 1989; Guibas et al. 1993; Li and Milenkovic 1990]. In
R3, Sugihara [1992] and Dey et al. [1992] produce a topologically robust
convex hull and Delaunay triangulation. Their algorithms are a variation
of Beneath-Beyond with steps to prevent topological anomalies such as in
Figure 5. The output may contain unbounded geometric faults.
There are several implementations for computing the convex hull with
precise arithmetic. The output is a triangulation. If the input is degenerate,
the output may contain simplices with zero volume. Clarkson’s hull imple-
mentation of the randomized incremental algorithm restricts the input
precision to about 15 decimal digits. The implementation computes the
exact sign of determinants [Clarkson 1992]. It is a practical solution for
precise convex hulls and Delaunay triangulations [Clarkson 1995].
We timed hull, hullio (a precursor of hull without exact arithmetic, per-
sonal communication, S. Dorward, 1992), triangle [Shewchuk 1996] (a
two-dimensional Delaunay triangulation program with exact arithmetic),
and our implementation of Quickhull (qhull 2.2) on a Silicon Graphics
100MHz R4000. These are fastest implementations known to the authors.
We used a Sun SPARCstation for performance tuning of qhull. The times
are the average and range of user CPU seconds for 10 different trials.
hull computed the Delaunay triangulations of 10,000 uniform random
points in a square in 10.23 (10.0 –10.5) seconds, while qhull with merging
computed them in 6.61 (6.5– 6.7) seconds. If we compare hullio and qhull
without merging, the corresponding figures are 6.2 (6.0 – 6.4) and 5.93
(5.8 – 6.1) respectively. The difference between hull and qhull with merging
is largely due to exact arithmetic. Specialized code for two dimensions is
much faster. The triangle program computes the same Delaunay triangula-
tions in 1.3 (1.3–1.4) seconds.
hull computed the convex hulls of 20,000 uniform random points in a cube
in 9.9 (8.2–10.9) seconds. hullio computed them in 4.5 (4.0 –5.4) seconds.
qhull with merging computed them in 1.75 (1.6 –2.1) seconds, and qhull
without merging computed them in 1.67 (1.6 –1.8) seconds. These figures
support the previous comparison for uniform random points.
hull computed the convex hulls of 5000 random points on the surface of a
hypercube in 28 (26 –32) seconds. They had 6700 facets on average. For the
same inputs, qhull with merging produced 1700 facets on average in 5.6
(5.2– 6.0) seconds. It merged 2300 (2000 –2500) facets. There was one facet
of the convex hull for each facet of the hypercube. These facets contained
4500 coplanar points on average. qhull without merging produced 4300
facets on average in 1.9 (1.7–2.0) seconds. The larger ratios between hull,
qhull with merging, and qhull without merging reflect the increased use of
exact arithmetic and facet merging.
5. SUMMARY
Our goal is a practical algorithm for general-dimension convex hulls. We
have shown empirical evidence that the algorithm satisfies its balance
conditions and that it performs like a randomized incremental algorithm
that is output sensitive to the number of vertices. The Quickhull Algorithm
uses less space than most of the randomized incremental algorithms and
executes faster for inputs with nonextreme points.
In addition, Quickhull uses merged facets to guarantee that the output is
clearly convex. The algorithm is implemented with floating-point arith-
metic. It reports the maximum width of a merged facet. In R5 and higher,
the maximum width may be wider than reported.
We have implemented Quickhull for general dimension. The program
qhull computes convex hulls, Delaunay triangulations, Voronoi vertices,
furthest-site Voronoi vertices, and halfspace intersections. It is available
via http://www.geom.umn.edu/locate/qhull and ftp://geom.umn.edu/pub/
software/qhull.tar.Z. The program includes options for imprecise data and
arithmetic, facet area and hull volume, partial hulls, input transforma-
tions, randomization, tracing, multiple output formats, graphical output,
and execution statistics. The program can be called from within an applica-
tion.
Over the last two years, 3000 copies of qhull were retrieved via ftp. It has
been used for support structures in layered manufacturing [Allen and
Dutta 1995], classification of molecules by their biological activity, vibra-
tion control, geographic information systems, neighbors of the origin in the
R8 lattice, stress analysis, stability of robot grasps (personal communica-
tions, L. Belsis et al., 1995), spectrometry [Boardman 1993], constrained
control allocation [Bordignon and Durham 1995], robot navigation [Cucka
et al. 1995], micromagnetic modeling [Porter et al. 1996], and invariant
sets of delta-sigma modulators [Zhang et al. 1994].
ACKNOWLEDGMENTS
Albert Marden and Victor Milenkovic provided excellent environments for
completing this work. The referees’ comments greatly improved the presen-
tation and content of this article.
REFERENCES
BOISSONNAT, J.-D. AND TEILLAUD, M. 1993. On the randomized construction of the Delaunay
tree. Theoret. Comput. Sci. 112, 339 –354.
BORDIGNON, K. A. AND DURHAM, W. C. 1995. Closed-form solutions to constrained control
allocation problem. J. Guidance Contr. Dynam. 18, 5, 1000 –1007.
BROWN, D. 1979. Voronoi diagrams from convex hulls. Inf. Process. Lett. 9, 223–228.
BYKAT, A. 1978. Convex hull of a finite set of points in two dimensions. Inf. Process. Lett. 7,
296 –298.
CHAND, D. AND KAPUR, S. 1970. An algorithm for convex polytopes. J. ACM 7, 1, 78 – 86.
CHAZELLE, B. AND MATOUS̆EK, J. 1992. Randomizing an output-sensitive convex hull algo-
rithm in three dimensions. Tech. Rep. TR-361-92, Princeton Univ., Princeton, N.J.
CLARKSON, K. AND SHOR, P. 1989. Applications of random sampling in computational
geometry, ii. Discr. Comput. Geom. 4, 387– 421.
CLARKSON, K. L. 1992. Safe and effective determinant evaluation. In Proceedings of the 31st
IEEE Symposium on Foundations of Computer Science. IEEE, New York, 387–395.
CLARKSON, K. L. 1995. A program for convex hulls. ATT, Murray Hill, N.J. Available as
http://netlib.att.com/netlib/voronoi/hull.html.
CLARKSON, K. L., MEHLHORN, K., AND SEIDEL, R. 1993. Four results on randomized incre-
mental constructions. Comput. Geom. Theory Appl. 3, 185–211. Also in Lecture Notes in
Computer Science. Vol. 577, pp. 463– 474.
CUCKA, P., NETANYAHU, N., AND ROSENFELD, A. 1995. Learning in navigation: Goal finding in
graphs. Tech. Rep. CAR-TR-759, Center for Automation Research, Univ. of Maryland,
College Park, Md.
DEY, T. K., SUGIHARA, K., AND BAJAJ, C. L. 1992. Delaunay triangulations in three dimen-
sions with finite precision arithmetic. Comput. Aided Geom. Des. 9, 457– 470.
EDDY, W. 1977. A new convex hull algorithm for planar sets. ACM Trans. Math. Softw. 3, 4,
398 – 403.
EDELSBRUNNER, H. AND SHAH, N. 1992. Incremental topological flipping works for regular
triangulations. In Proceedings of the Symposium on Computational Geometry. ACM, New
York, 43–52.
FORTUNE, S. 1989. Stable maintenance of point-set triangulation in two-dimensions. In the
30th Annual Symposium on the Foundations of Computer Science. IEEE, New York.
FORTUNE, S. 1993. Computational geometry. In Directions in Geometric Computing, R. Mar-
tin, Ed. Information Geometers, Winchester, U.K.
FUKUDA, K. AND PRODON, A. 1996. Double description method revisited. In Lecture Notes in
Computer Science, vol. 1120. Springer-Verlag, Berlin. Available also at ftp://ifor13.ethz.ch/
pub/fukuda/cdd.
GREEN P. AND SILVERMAN, B. 1979. Constructing the convex hull of a set of points in the
plane. Comput. J. 22, 262–266.
GRÜNBAUM, B. 1961. Measure of symmetry for convex sets. In Proceedings of the 7th
Symposium in Pure Mathematics of the American Mathematical Society, Symposium on
Convexity. AMS, Providence, R.I., 233–270.
GUIBAS, L., KNUTH, D., AND SHARIR, M. 1992. Randomized incremental construction of
Delaunay and Voronoi diagrams. Algorithmica 9, 534 –560.
JOE, B. 1991. Construction of three-dimensional Delaunay triangulations using local trans-
formations. Comput. Aided Geom. Des. 8, 123–142.
KALLAY, M. 1981. Convex hull algorithms in higher dimensions. Unpublished manuscript,
Dept. of Mathematics, Univ. of Oklahoma, Norman, Okla.
KIRKPATRICK, D. AND SEIDEL, R. 1986. The ultimate planar convex hull algorithm? SIAM
J. Comput. 15, 287–299.
KLEE, V. 1966. Convex polytopes and linear programming. In Proceedings of the IBM
Scientific Computing Symposium: Combinatorial Problems. IBM, Armonk, N.Y., 123–158.
LI, Z. AND MILENKOVIC, V. 1990. Constructing strongly convex hulls using exact or rounded
arithmetic. In Proceedings of the Symposium on Computational Geometry. ACM, New York,
197–207.
MOTZKIN, T. S., RAIFFA, H., THOMPSON, G. L., AND THRALL, R. M. 1953. The double descrip-
tion method. In Contributions of the Theory of Games II, H. W. Kuhn and A. W. Tucker, Eds.
Annals of Mathematics, vol. 8. Princeton University Press, Princeton, N.J., 51–73.
MULMULEY, D. 1994. Computational Geometry, An Introduction through Randomized Algo-
rithms. Prentice-Hall, Englewood Cliffs, N.J.
PORTER, D., GLAVINAS, E., DHAGAT, P., O’SULLIVAN, J. A., INDECK, R. S., AND MULLER, M. W.
1996. Irregular grain structure in micromagnetic simulation. J. Appl. Physics 79, 8,
4694 – 4696.
PREPARATA, D. F. AND SHAMOS, M. 1985. Computational Geometry. An Introduction. Springer-
Verlag, Berlin.
SEIDEL, R. 1986. Constructing higher-dimensional convex hulls at logarithmic cost per face.
In Proceedings of the 18th ACM Symposium on the Theory of Computing. ACM, New York,
404 – 413.
SHEWCHUK, J. R. 1996. Triangle: Engineering a 2D quality mesh generator and delaunay
triangulator. In the 1st Workshop on Applied Computational Geometry. ACM, New York.
Also available as http://www.cs.cmu.edu/ ˜quake/triangle.html.
SUGIHARA, K. 1992. Topologically consistent algorithms related to convex polyhedra. In
Algorithms and Computation, 3rd International Symposium (ISSAC ’92). Lecture Notes in
Computer Science, vol. 650. Springer-Verlag, Berlin, 209 –218.
WEEKS, J. 1991. Convex hulls and isometrics of cusped hyperbolic 3-manifolds. Tech. Rep.
TR GCG32, The Geometry Center, Univ. of Minnesota, Minneapolis, Minn. Aug.
ZHANG, B., GOODSON, M., AND SCHREIER, R. 1994. Invariant sets for general second-order
low-pass delta-sigma modulators with dc inputs. In the IEEE International Symposium on
Circuits and Systems. IEEE, New York, 1– 4.
Received September 1993; revised June 1995 and January 1996; accepted April 1996