Up: Home page for Qhull
Up: Qhull manual: Table of Contents
Up: Qhull options: Table of Contents
Up: Qhull internals: Table of Contents
To: Qhull files (please wait while loading)
To: Geom Global
Io Mem
Merge Poly
Qhull Set
Stat User
The following sections provide an overview and index to Qhull's functions, macros, and data structures.
Each section starts with an introduction.
Qhull uses the following conventions:
When reading the code, please note that the global data structure, 'qh', is a macro. It either expands to "qh_qh." or to "qh_qh->". The later is used for applications which run concurrent calls to qh_qhull().
When reading code with an editor, a search for "procedure will locate the header of qh_procedure. A search for * procedure will locate the tail of qh_procedure.
If your web browser loads .c and .h files with an external application, change the MIME type of .c and .h files to "text/html". Do not use the Opera browser (it treats all '<' characters as HTML tags).
Please report documentation and link errors to qhull-bug@geom.umn.edu. If you have a program that checks internal links ("#..."), please send the results of running the program on qhull.
Brad Barber, Cambridge MA, August 3, 1998
Copyright © 1997-1998 The Geometry Center, Minneapolis MN
This sections lists the .c and .h files for Qhull. Please refer to these files for detailed information.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Geometrically, a vertex is a point with d coordinates and a facet is a halfspace. A halfspace is defined by an oriented hyperplane through the facet's vertices. A hyperplane is defined by d normalized coefficients and an offset. A point is above a facet if its distance to the facet is positive.
Qhull uses floating point coordinates for input points, vertices, halfspace equations, centrums, and an interior point.
Qhull may be configured for single precision or double precision floating point arithmetic (see realT ).
Each floating point operation may incur round-off error (see Merge). The maximum error for distance computations is determined at initialization. The roundoff error in halfspace computation is accounted for by computing the distance from vertices to the halfspace.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull uses a global data structure, qh, to store globally defined constants, lists, sets, and variables. This allows multiple instances of Qhull to execute at the same time. The structure may be statically allocated or dynamically allocated with malloc(). See QHpointer.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull provides a wide range of input and output options. To organize the code, most output formats use the same driver:
qh_printbegin( fp, format, facetlist, facets, printall ); FORALLfacet_( facetlist ) qh_printafacet( fp, format, facet, printall ); FOREACHfacet_( facets ) qh_printafacet( fp, format, facet, printall ); qh_printend( fp, format );
Note the 'printall' flag. It selects whether or not qh_skipfacet() is tested.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull uses quick-fit memory allocation. It maintains a set of free lists for a variety of small allocations. A small request returns a block from the best fitting free list. If the free list is empty, Qhull allocates a block from a reserved buffer.
Use 'T5' to trace memory allocations.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull handles precision problems by merging facets. Except for redundant vertices, it corrects a problem by merging two facets. When done, all facets are clearly convex. See Imprecision in Qhull for further information.
Users may joggle the input ('QJn') instead of merging facets.
Qhull detects and corrects the following problems:
» Geom Global Io Mem Merge Poly Qhull Set Stat User
If a point is coplanar with an horizon facet, the corresponding new facets are linked together (a samecycle) for merging.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull uses dimension-free terminology. Qhull builds a polyhedron in dimension d. A polyhedron is a simplicial complex of faces with geometric information for the top and bottom-level faces. A (d-1)-face is a facet, a (d-2)-face is a ridge, and a 0-face is a vertex. For example in 3-d, a facet is a polygon and a ridge is an edge. A facet is built from a ridge (the base) and a vertex (the apex). See Qhull's data structures.
Qhull's primary data structure is a polyhedron. A polyhedron is a list of facets. Each facet has a set of neighoring facets and a set of vertices. Each facet has a hyperplane. For example, a tetrahedron has four facets. If its vertices are a, b, c, d, and its facets are 1, 2, 3, 4, the tetrahedron is
A facet may be simplicial or non-simplicial. In 3-d, a simplicial facet has three vertices and three neighbors. A nonsimplicial facet has more than three vertices and more than three neighbors. A nonsimplicial facet has a set of ridges and a centrum.
A simplicial facet has an orientation. An orientation is either top or bottom. The flag, facet->toporient, defines the orientation of the facet's vertices. For example in 3-d, 'top' is left-handed orientation (i.e., the vertex order follows the direction of the left-hand fingers when the thumb is pointing away from the center). Except for axis-parallel facets in 5-d and higher, topological orientation determines the geometric orientation of the facet's hyperplane.
A nonsimplicial facet is due to merging two or more facets. The facet's ridge set determine a simplicial decomposition of the facet. Each ridge is a 1-face (i.e., it has two vertices and two neighboring facets). The orientation of a ridge is determined by the order of the neighboring facets. The flag, facet->toporient,is ignored.
A nonsimplicial facet has a centrum for testing convexity. A centrum is a point on the facet's hyperplane that is near the center of the facet. Except for large facets, it is the arithmetic average of the facet's vertices.
A nonsimplicial facet is an approximation that is defined by offsets from the facet's hyperplane. When Qhull finishes, the outer plane is above all points while the inner plane is below the facet's vertices. This guarantees that any exact convex hull passes between the inner and outer planes. The outer plane is defined by facet->maxoutside while the inner plane is computed from the facet's vertices.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull implements the Quickhull algorithm for computing the convex hull. The Quickhull algorithm combines two well-known algorithms: the 2-d quickhull algorithm and the n-d beneath-beyond algorithm. See Description of Qhull.
This section provides an index to the top-level functions and base data types. The top-level header file, qhull.h, contains prototypes for these functions.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull's data structures are constructed from sets. The functions and macros in qset.c construct, iterate, and modify these sets. They are the most frequently called functions in Qhull. For this reason, efficiency is the primary concern.
In Qhull, a set is represented by an unordered array of pointers with a maximum size and a NULL terminator (setT). Most sets correspond to mathematical sets (i.e., the pointers are unique). Some sets are sorted to enforce uniqueness. Some sets are ordered. For example, the order of vertices in a ridge determine the ridge's orientation. If you reverse the order of adjacent vertices, the orientation reverses. Some sets are not mathematical sets. They may be indexed as an array and they may include NULL pointers.
The most common operation on a set is to iterate its members. This is done with a 'FOREACH...' macro. Each set has a custom macro. For example, 'FOREACHvertex_' iterates over a set of vertices. Each vertex is assigned to the variable 'vertex' from the pointer 'vertexp'.
Most sets are constructed by appending elements to the set. The last element of a set is either NULL or the index of the terminating NULL for a partially full set. If a set is full, appending an element copies the set to a larger array.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Qhull records many statistics. These functions and macros make it inexpensive to add a statistic.
As with Qhull's global variables, the statistics data structure is accessed by a macro, 'qhstat'. If qh_QHpointer is defined, the macro is 'qh_qhstat->', otherwise the macro is 'qh_qhstat.'. Statistics may be turned off in user.h. If so, all but the 'zz' statistics are ignored.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
» Geom Global Io Mem Merge Poly Qhull Set Stat User
This section contains functions and constants that the user may want to change.
» Geom Global Io Mem Merge Poly Qhull Set Stat User
Up:
Home page for
Qhull
Up: Qhull manual: Table of Contents
Up: Qhull options: Table of Contents
Up: Qhull internals: Table of Contents
To: Qhull files
To: Geom
Global Io
Mem Merge
Poly Qhull
Set Stat
User
Comments to:
qhull@geom.umn.edu
Created: May 2, 1997 --- Last modified: see top