Up: Home page for Qhull
Up:News about Qhull
Up: FAQ about Qhull
To: Qhull manual: Table of Contents
(please wait while loading)
To: Programs
Options
Output
Formats
Geomview
Print
Qhull
Precision
Trace
Qhull is a general dimension code for computing convex hulls, Delaunay triangulations, halfspace intersections about a point, Voronoi diagrams, furthest-site Delaunay triangulations, and furthest-site Voronoi diagrams. These structures have applications in science, engineering, statistics, and mathematics. See Fukuda's introduction to convex hulls, Delaunay triangulations, Voronoi diagrams, and linear programming. For a detailed introduction, see O'Rourke ['94], Computational Geometry in C.
There are six programs. Except for rbox, they use the same code.
- qconvex -- convex hulls
- qdelaunay -- Delaunay triangulations and furthest-site Delaunay triangulations
- qhalf -- halfspace intersections about a point
- qhull -- all structures with additional options
- qvoronoi -- Voronoi diagrams and furthest-site Voronoi diagrams
- rbox -- generate point distributions for qhull
Qhull implements the Quickhull algorithm for computing the convex hull. Qhull includes options for hull volume, facet area, multiple output formats, and graphical output. It can approximate a convex hull.
Qhull handles roundoff errors from floating point arithmetic. It generates a convex hull with "thick" facets. A facet's outer plane is clearly above all of the points; its inner plane is clearly below the facet's vertices. Any exact convex hull must lie between the inner and outer plane.
Qhull uses merged facets, triangulated output, or joggled input. Triangulated output triangulates non-simplicial, merged facets. Joggled input also guarantees simplicial output, but it is less accurate than merged facets. For merged facets, Qhull reports the maximum outer and inner plane.
Brad Barber, Cambridge MA, 2003/12/30
Copyright © 1995-2003 The Geometry Center, Minneapolis MN
Qhull constructs convex hulls, Delaunay triangulations, halfspace intersections about a point, Voronoi diagrams, furthest-site Delaunay triangulations, and furthest-site Voronoi diagrams.
For convex hulls and halfspace intersections, Qhull may be used for 2-d upto 8-d. For Voronoi diagrams and Delaunay triangulations, Qhull may be used for 2-d upto 7-d. In higher dimensions, the size of the output grows rapidly and Qhull does not work well with virtual memory. If n is the size of the input and d is the dimension (d>=3), the size of the output and execution time grows by n^(floor(d/2) [see Performance]. For example, do not try to build a 16-d convex hull of 1000 points. It will have on the order of 1,000,000,000,000,000,000,000,000 facets.
On a 600 MHz Pentium 3, Qhull computes the 2-d convex hull of 300,000 cocircular points in 11 seconds. It computes the 2-d Delaunay triangulation and 3-d convex hull of 120,000 points in 12 seconds. It computes the 3-d Delaunay triangulation and 4-d convex hull of 40,000 points in 18 seconds. It computes the 4-d Delaunay triangulation and 5-d convex hull of 6,000 points in 12 seconds. It computes the 5-d Delaunay triangulation and 6-d convex hull of 1,000 points in 12 seconds. It computes the 6-d Delaunay triangulation and 7-d convex hull of 300 points in 15 seconds. It computes the 7-d Delaunay triangulation and 8-d convex hull of 120 points in 15 seconds. It computes the 8-d Delaunay triangulation and 9-d convex hull of 70 points in 15 seconds. It computes the 9-d Delaunay triangulation and 10-d convex hull of 50 points in 17 seconds. The 10-d convex hull of 50 points has about 90,000 facets.
Qhull does not support constrained Delaunay triangulations, triangulation of non-convex surfaces, mesh generation of non-convex objects, or medium-sized inputs in 9-D and higher.
This is a big package with many options. It is one of the fastest available. It is the only 3-d code that handles precision problems due to floating point arithmetic. For example, it implements the identity function for extreme points (see Imprecision in Qhull).
If you need a short code for convex hull, Delaunay triangulation, or Voronoi volumes consider Clarkson's hull program. If you need 2-d Delaunay triangulations consider Shewchuk's triangle program. It is much faster than Qhull and it allows constraints. Both programs use exact arithmetic. They are in ftp://netlib.bell-labs.com/netlib/voronoi. Qhull version 1.0 may also meet your needs. It detects precision problems, but does not handle them.
Leda is a library for writing computational geometry programs and other combinatorial algorithms. It includes routines for computing 3-d convex hulls, 2-d Delaunay triangulations, and 3-d Delaunay triangulations. It provides rational arithmetic and graphical output. It runs on most platforms.
If your problem is in high dimensions with a few, non-simplicial facets, try Fukuda's cdd. It is much faster than Qhull for these distributions.
Custom software for 2-d and 3-d convex hulls may be faster than Qhull. Custom software should use less memory. Qhull uses general-dimension data structures and code. The data structures support non-simplicial facets.
Qhull is not suitable for mesh generation or triangulation of arbitrary surfaces. You may use Qhull if the surface is convex or completely visible from an interior point (e.g., a star-shaped polyhedron). First, project each site to a sphere that is centered at the interior point. Then, compute the convex hull of the projected sites. The facets of the convex hull correspond to a triangulation of the surface. For mesh generation of arbitrary surfaces, see Schneiders' Finite Element Mesh Generation.
Qhull is not suitable for constrained Delaunay triangulations. With a lot of work, you can write a program that uses Qhull to add constraints by adding additional points to the triangulation.
Qhull is not suitable for the subdivision of arbitrary objects. Use qdelaunay to subdivide a convex object.
»definition
The convex hull of a point set P is the smallest convex set that contains P. If P is finite, the convex hull defines a matrix A and a vector b such that for all x in P, Ax+b <= [0,...].
Qhull computes the convex hull in 2-d, 3-d, 4-d, and higher dimensions. Qhull represents a convex hull as a list of facets. Each facet has a set of vertices, a set of neighboring facets, and a halfspace. A halfspace is defined by a unit normal and an offset (i.e., a row of A and an element of b).
Qhull accounts for round-off error. It returns "thick" facets defined by two parallel hyperplanes. The outer planes contain all input points. The inner planes exclude all output vertices. See Imprecise convex hulls.
Qhull may be used for the Delaunay triangulation or the Voronoi diagram of a set of points. It may be used for the intersection of halfspaces.
»input format
The input data on stdin consists of:
- first line contains the dimension
- second line contains the number of input points
- remaining lines contain point coordinates
For example:
3 #sample 3-d input 5 0.4 -0.5 1.0 1000 -1e-5 -100 0.3 0.2 0.1 1.0 1.0 1.0 0 0 0Input may be entered by hand. End the input with a control-D (^D) character.
To input data from a file, use I/O redirection or 'TI file'. The filename may not include spaces or quotes.
A comment starts with a non-numeric character and continues to the end of line. The first comment is reported in summaries and statistics. With multiple qhull commands, use option 'FQ' to place a comment in the output.
The dimension and number of points can be reversed. Comments and line breaks are ignored. Error reporting is better if there is one point per line.
»option format
Use options to specify the output formats and control Qhull. The qhull program takes all options. The other programs use a subset of the options. They disallow experimental and inappropriate options.
- qconvex == qhull
- qdelaunay == qhull d Qbb
- qhalf == qhull H
- qvoronoi == qhull v Qbb
Single letters are used for output formats and precision constants. The other options are grouped into menus for formats ('F'), Geomview ('G '), printing ('P'), Qhull control ('Q '), and tracing ('T'). The menu options may be listed together (e.g., 'GrD3' for 'Gr' and 'GD3'). Options may be in any order. Capitalized options take a numeric argument (except for 'PG' and 'F' options). Use option 'FO' to print the selected options.
Qhull uses zero-relative indexing. If there are n points, the index of the first point is 0 and the index of the last point is n-1.
The default options are:
Except for bounding box ('Qbk:n', etc.), drop facets ('Pdk:n', etc.), and Qhull command ('FQ'), only the last occurence of an option counts. Bounding box and drop facets may be repeated for each dimension. Option 'FQ' may be repeated any number of times.
The Unix tcsh and ksh shells make it easy to try out different options. In Windows 95, use a DOS window with doskey and a window scroller (e.g., peruse).
»output format
To write the results to a file, use I/O redirection or 'TO file'. Windows 95 users should use 'TO file' or the console. If a filename is surrounded by single quotes, it may include spaces.
The default output option is a short summary ('s') to stdout. There are many others (see output and formats). You can list vertex incidences, vertices and facets, vertex coordinates, or facet normals. You can view Qhull objects with Geomview, Mathematica, or Maple. You can print the internal data structures. You can call Qhull from your application (see Qhull library).
For example, 'qhull o' lists the vertices and facets of the convex hull.
Error messages and additional summaries ('s') go to stderr. Unless redirected, stderr is the console.
»algorithm
Qhull implements the Quickhull algorithm for convex hull [Barber et al. '96]. This algorithm combines the 2-d Quickhull algorithm with the n-d beneath-beyond algorithm [c.f., Preparata & Shamos '85]. It is similar to the randomized algorithms of Clarkson and others [Clarkson & Shor '89; Clarkson et al. '93; Mulmuley '94]. For a demonstration, see How Qhull adds a point. The main advantages of Quickhull are output sensitive performance (in terms of the number of extreme points), reduced space requirements, and floating-point error handling.
»data structures
Qhull produces the following data structures for dimension d:
- A coordinate is a real number in floating point format.
- A point is an array of d coordinates. With option 'QJ', the coordinates are joggled by a small amount.
- A vertex is an input point.
- A hyperplane is d normal coefficients and an offset. The length of the normal is one. The hyperplane defines a halfspace. If V is a normal, b is an offset, and x is a point inside the convex hull, then Vx+b <0.
- An outer plane is a positive offset from a hyperplane. When Qhull is done, all points will be below all outer planes.
- An inner plane is a negative offset from a hyperplane. When Qhull is done, all vertices will be above the corresponding inner planes.
- An orientation is either 'top' or 'bottom'. It is the topological equivalent of a hyperplane's geometric orientation.
- A simplicial facet is a set of d neighboring facets, a set of d vertices, a hyperplane equation, an inner plane, an outer plane, and an orientation. For example in 3-d, a simplicial facet is a triangle.
- A centrum is a point on a facet's hyperplane. A centrum is the average of a facet's vertices. Neighboring facets are convex if each centrum is below the neighbor facet's hyperplane.
- A ridge is a set of d-1 vertices, two neighboring facets, and an orientation. For example in 3-d, a ridge is a line segment.
- A non-simplicial facet is a set of ridges, a hyperplane equation, a centrum, an outer plane, and an inner plane. The ridges determine a set of neighboring facets, a set of vertices, and an orientation. Qhull produces a non-simplicial facet when it merges two facets together. For example, a cube has six non-simplicial facets.
For examples, use option 'f'. See polyhedron operations for further design documentation.
»Imprecision in Qhull
See Imprecision in Qhull.
»Geomview, Qhull's graphical viewer
Geomview is an interactive geometry viewing program for Linux, SGI workstations, Sun workstations, AIX workstations, NeXT workstations, and X-windows. It is an open source project under SourceForge. Besides a 3-d viewer, it includes a 4-d viewer, an n-d viewer and many features for viewing mathematical objects. You may need to ftp ndview from the newpieces directory.
»Description of Qhull examples
See Options.
See Internals.
Please report bugs to qhull_bug@qhull.org . Please report if Qhull crashes. Please report if Qhull generates an "internal error". Please report if Qhull produces a poor approximate hull in 2-d, 3-d or 4-d. Please report documentation errors. Please report missing or incorrect links.
If you do not understand something, try a small example. The rbox program is an easy way to generate test cases. The Geomview program helps to visualize the output from Qhull.
If Qhull does not compile, it is due to an incompatibility between your system and ours. The first thing to check is that your compiler is ANSI standard. Qhull produces a compiler error if __STDC__ is not defined. You may need to set a flag (e.g., '-A' or '-ansi').
If Qhull compiles but crashes on the test case (rbox D4), there's still incompatibility between your system and ours. Sometimes it is due to memory management. This can be turned off with qh_NOmem in mem.h. Please let us know if you figure out how to fix these problems.
If you doubt the output from Qhull, add option 'Tv'. It checks that every point is inside the outer planes of the convex hull. It checks that every facet is convex with its neighbors. It checks the topology of the convex hull.
Qhull should work on all inputs. It may report precision errors if you turn off merged facets with option 'Q0'. This can get as bad as facets with flipped orientation or two facets with the same vertices. You'll get a long help message if you run into such a case. They are easy to generate with rbox.
If you do find a problem, try to simplify it before reporting the error. Try different size inputs to locate the smallest one that causes an error. You're welcome to hunt through the code using the execution trace ('T4') as a guide. This is especially true if you're incorporating Qhull into your own program.
When you report an error, please attach a data set to the end of your message. Include the options that you used with Qhull, the results of option 'FO', and any messages generated by Qhull. This allows me to see the error for myself. Qhull is maintained part-time.
Please send correspondence to Brad Barber at qhull@qhull.org and report bugs to qhull_bug@qhull.org . Let me know how you use Qhull. If you mention it in a paper, please send a reference and abstract.
If you would like to get Qhull announcements (e.g., a new version) and news (any bugs that get fixed, etc.), let us know and we will add you to our mailing list. If you would like to communicate with other Qhull users, I will add you to the qhull_users alias. For Internet news about geometric algorithms and convex hulls, look at comp.graphics.algorithms and sci.math.num-analysis. For Qhull news look at qhull-news.html.
C. Bradford Barber Hannu Huhdanpaa bradb@qhull.org hannu@qhull.org c/o The Geometry Center University of Minnesota 400 Lind Hall 207 Church Street S.E. Minneapolis, MN 55455
A special thanks to David Dobkin for his guidance. A special thanks to Albert Marden, Victor Milenkovic, the Geometry Center, and Harvard University for supporting this work.
A special thanks to Mark Phillips, Robert Miner, and Stuart Levy for running the Geometry Center web site long after the Geometry Center closed. Stuart moved the web site to the University of Illinois at Champaign-Urbana. Mark and Robert are founders of Geometry Technologies. Mark, Stuart, and Tamara Munzner are the original authors of Geomview.
A special thanks to Endocardial Solutions, Inc. of St. Paul, Minnesota for their support of the internal documentation (src/index.htm). They use Qhull to build 3-d models of heart chambers.
Qhull 1.0 and 2.0 were developed under National Science Foundation grants NSF/DMS-8920161 and NSF-CCR-91-15793 750-7504. If you find it useful, please let us know.
The Geometry Center was supported by grant DMS-8920161 from the National Science Foundation, by grant DOE/DE-FG02-92ER25137 from the Department of Energy, by the University of Minnesota, and by Minnesota Technology, Inc.
Aurenhammer, F., "Voronoi diagrams -- A survey of a fundamental geometric data structure," ACM Computing Surveys, 1991, 23:345-405.
Barber, C. B., D.P. Dobkin, and H.T. Huhdanpaa, "The Quickhull Algorithm for Convex Hulls," ACM Transactions on Mathematical Software, 22(4):469-483, www.qhull.org [http://www.acm.org; http://citeseer.nj.nec.com].
Clarkson, K.L. and P.W. Shor, "Applications of random sampling in computational geometry, II", Discrete Computational Geometry, 4:387-421, 1989
Clarkson, K.L., K. Mehlhorn, and R. Seidel, "Four results on randomized incremental construction," Computational Geometry: Theory and Applications, vol. 3, p. 185-211, 1993.
Devillers, et. al., "Walking in a triangulation," ACM Symposium on Computational Geometry, June 3-5,2001, Medford MA.
Dobkin, D.P. and D.G. Kirkpatrick, "Determining the separation of preprocessed polyhedra--a unified approach," in Proc. 17th Inter. Colloq. Automata Lang. Program., in Lecture Notes in Computer Science, Springer-Verlag, 443:400-413, 1990.
Edelsbrunner, H, Geometry and Topology for Mesh Generation, Cambridge University Press, 2001.
Gartner, B., "Fast and robust smallest enclosing balls", Algorithms - ESA '99, LNCS 1643.
Fortune, S., "Computational geometry," in R. Martin, editor, Directions in Geometric Computation, Information Geometers, 47 Stockers Avenue, Winchester, SO22 5LB, UK, ISBN 1-874728-02-X, 1993.
Milenkovic, V., "Robust polygon modeling," Computer-Aided Design, vol. 25, p. 546-566, September 1993.
Mucke, E.P., I. Saias, B. Zhu, Fast randomized point location without preprocessing in Two- and Three-dimensional Delaunay Triangulations, ACM Symposium on Computational Geometry, p. 274-283, 1996 [GeomDir].
Mulmuley, K., Computational Geometry, An Introduction Through Randomized Algorithms, Prentice-Hall, NJ, 1994.
O'Rourke, J., Computational Geometry in C, Cambridge University Press, 1994.
Preparata, F. and M. Shamos, Computational Geometry, Springer-Verlag, New York, 1985.
Up: Home page for Qhull
Up:News about Qhull
Up: FAQ about Qhull
To: Qhull manual: Table of Contents
To: Programs
Options
Output
Formats
Geomview
Print
Qhull
Precision
Trace
Dn: Imprecision in Qhull
Dn: Description of Qhull examples
Dn: Qhull internals
Dn: Qhull functions, macros, and data
structures
Comments to: qhull@qhull.org
Created: Sept. 25, 1995 --- Last modified: see top