Up: Home page for Qhull
Up: Qhull manual -- Table of Contents
To: Programs • Options • Output • Formats • Geomview • Print • Qhull • Precision • Trace
To: synopsis • input • outputs • controls • graphics • notes • conventions • options

# qconvex -- convex hull

The convex hull of a set of points is the smallest convex set containing the points. See the detailed introduction by O'Rourke ['94]. See Description of Qhull and How Qhull adds a point.

> Example: rbox 10 D3 | qconvex s o TO result
>   Compute the 3-d convex hull of 10 random points. Write a summary to the console and the points and facets to 'result'.
> Example: rbox c | qconvex n
>   Print the normals for each facet of a cube.
> Example: rbox c | qconvex i Qt
>   Print the triangulated facets of a cube.
> Example: rbox y 500 W0 | qconvex
>   Compute the convex hull of a simplex with 500 points on its surface.
> Example: rbox x W1e-12 1000 | qconvex QR0
>   Compute the convex hull of 1000 points near the surface of a randomly rotated simplex. Report the maximum thickness of a facet.
> Example: rbox 1000 s | qconvex s FA
>   Compute the convex hull of 1000 cospherical points. Verify the results and print a summary with the total area and volume.
> Example: rbox d D12 | qconvex QR0 FA
>   Compute the convex hull of a 12-d diamond. Randomly rotate the input. Note the large number of facets and the small volume.
> Example: rbox c D7 | qconvex FA TF1000
>   Compute the convex hull of the 7-d hypercube. Report on progress every 1000 facets. Computing the convex hull of the 9-d hypercube takes too much time and space.
> Example: rbox c d D2 | qconvex Qc s f Fx | more
>   Dump all fields of all facets for a square and a diamond. Also print a summary and a list of vertices. Note the coplanar points.

Except for rbox, all of the qhull programs compute a convex hull.

If you use 'Qt' (triangulated output) or 'QJ' (joggled input), all facets will be simplicial (e.g., triangles in 3-d). If you do not use 'QJ', `qconvex` merges coplanar facets. This is more accurate than joggled input. With 'QJ', duplicate points will be joggled apart. See Joggled input or merged facets.

The output for 4-d convex hulls may be confusing if the convex hull contains non-simplicial facets (e.g., a hypercube). See Why are there extra points in a 4-d or higher convex hull?

The 'qconvex' program is equivalent to 'qhull' in 2-d to 4-d, and 'qhull Qx' in 5-d and higher. It disables the following Qhull options: d v H Qbb Qf Qg Qm Qr Qu Qv Qx Qz TR E V Fp Gt Q0,etc.

Copyright © 1995-2002 The Geometry Center, Minneapolis MN

### »qconvex synopsis

    qconvex- compute the convex hull.
        input (stdin): dimension, number of points, point coordinates
        comments start with a non-numeric character

    options (qconvex.htm):
        Qt   - triangulated output
        QJ   - joggle input instead of merging facets
        Tv   - verify result: structure, convexity, and point inclusion
        .    - concise list of all options
        -    - one-line description of all options

    output options (subset):
        s    - summary of results (default)
        i    - vertices incident to each facet
        n    - normals with offsets
        p    - vertex coordinates (includes coplanar points if 'Qc')
        Fx   - extreme points (convex hull vertices)
        FA   - compute total area and volume
        o    - OFF format (dim, n, points, facets)
        G    - Geomview output (2-d, 3-d, and 4-d)
        m    - Mathematica output (2-d and 3-d)
        QVn  - print facets that include point n, -n if not
        TO file- output results to file, may be enclosed in single quotes

    examples:
        rbox c D2 | qconvex s n                    rbox c D2 | qconvex i
        rbox c D2 | qconvex o                      rbox 1000 s | qconvex s Tv FA
        rbox c d D2 | qconvex s Qc Fx              rbox y 1000 W0 | qconvex s n
        rbox y 1000 W0 | qconvex s QJ              rbox d G1 D12 | qconvex QR0 FA Pp
        rbox c D7 | qconvex FA TF1000

### »qconvex input

> The input data on `stdin` consists of:

> - dimension
> - number of points
> - point coordinates

> Use I/O redirection (e.g., qconvex < data.txt), a pipe (e.g., rbox 10 | qconvex), or the 'TI' option (e.g., qconvex TI data.txt).

> Comments start with a non-numeric character. Error reporting is simpler if there is one point per line. Dimension and number of points may be reversed.

> Here is the input for computing the convex hull of the unit cube. The output is the normals, one per facet.

> > rbox c > data

> >     3 RBOX c
> >     8
> >       -0.5   -0.5   -0.5
> >       -0.5   -0.5    0.5
> >       -0.5    0.5   -0.5
> >       -0.5    0.5    0.5
> >        0.5   -0.5   -0.5
> >        0.5   -0.5    0.5
> >        0.5    0.5   -0.5
> >        0.5    0.5    0.5

> > qconvex s n < data

> >     Convex hull of 8 points in 3-d:

> >       Number of vertices: 8
> >       Number of facets: 6
> >       Number of non-simplicial facets: 6

> >     Statistics for: RBOX c | QCONVEX s n

> >       Number of points processed: 8
> >       Number of hyperplanes created: 11
> >       Number of distance tests for qhull: 35
> >       Number of merged facets: 6
> >       Number of distance tests for merging: 84
> >       CPU seconds to compute hull (after input): 0.081

> >     4
> >     6
> >          0      0     -1   -0.5
> >          0     -1      0   -0.5
> >          1      0      0   -0.5
> >         -1      0      0   -0.5
> >          0      1      0   -0.5
> >          0      0      1   -0.5

### »qconvex outputs

> These options control the output of qconvex. They may be used individually or together.

> >   Vertices
> > Fx
> >   list extreme points (i.e., vertices). The first line is the number of extreme points. Each point is listed, one per line. The cube example has eight vertices.
> > Fv
> >   list vertices for each facet. The first line is the number of facets. Each remaining line starts with the number of vertices. For the cube example, each facet has four vertices.
> > i
> >   list vertices for each facet. The first line is the number of facets. The remaining lines list the vertices for each facet. In 3-d and higher, report cospherical sites by adding extra points.
> >   Coordinates
> > o
> >   print vertices and facets of the convex hull in OFF format. The first line is the dimension. The second line is the number of vertices, facets, and ridges. The vertex coordinates are next, followed by the facets. Each facet starts with the number of vertices. The cube example has four vertices per facet.
> > Ft
> >   print a triangulation of the convex hull in OFF format. The first line is the dimension. The second line is the number of vertices and added points, followed by the number of facets and the number of ridges. The vertex coordinates are next, followed by the centrum coordinates. There is one centrum for each non-simplicial facet. The cube example has six centrums, one per square. Each facet starts with the number of vertices or centrums. In the cube example, each facet uses two vertices and one centrum.
> > p
> >   print vertex coordinates. The first line is the dimension and the second line is the number of vertices. The following lines are the coordinates of each vertex. The cube example has eight vertices.
> > Qc p
> >   print coordinates of vertices and coplanar points. The first line is the dimension. The second line is the number of vertices and coplanar points. The coordinates are next, one line per point. Use 'Qc Qi p' to print the coordinates of all points.
> >   Facets
> > Fn
> >   list neighboring facets for each facet. The first line is the number of facets. Each remaining line starts with the number of neighboring facets. The cube example has four neighbors per facet.
> > FN
> >   list neighboring facets for each point. The first line is the total number of points. Each remaining line starts with the number of neighboring facets. Each vertex of the cube example has three neighboring facets. Use 'Qc Qi FN' to include coplanar and interior points.
> > Fa
> >   print area for each facet. The first line is the number of facets. Facet area follows, one line per facet. For the cube example, each facet has area one.
> > FI
> >   list facet IDs. The first line is the number of facets. The IDs follow, one per line.
> >   Coplanar and interior points
> > Fc
> >   list coplanar points for each facet. The first line is the number of facets. The remaining lines start with the number of coplanar points. A coplanar point is assigned to one facet.
> > Qi Fc
> >   list interior points for each facet. The first line is the number of facets. The remaining lines start with the number of interior points. A coplanar point is assigned to one facet.
> > FP
> >   print distance to nearest vertex for coplanar points. The first line is the number of coplanar points. Each remaining line starts with the point ID of a vertex, followed by the point ID of a coplanar point, its facet, and distance. Use 'Qc Qi FP' for coplanar and interior points.
> >   Hyperplanes
> > n
> >   print hyperplane for each facet. The first line is the dimension. The second line is the number of facets. Each remaining line is the hyperplane's coefficients followed by its offset.
> > Fo
> >   print outer plane for each facet. The output plane is above all points. The first line is the dimension. The second line is the number of facets. Each remaining line is the outer plane's coefficients followed by its offset.
> > Fi
> >   print inner plane for each facet. The inner plane of a facet is below its vertices. The first line is the dimension. The second line is the number of facets. Each remaining line is the inner plane's coefficients followed by its offset.
> >   General
> > s
> >   print summary for the convex hull. Use 'Fs' and 'FS' if you need numeric data.
> > FA
> >   compute total area and volume for 's' and 'FS'
> > m
> >   Mathematica output for the convex hull in 2-d or 3-d.
> > G
> >   Geomview output for the convex hull in 2-d, 3-d, or 4-d.
> >   Scaling and rotation
> > Qbk:n
> >   scale k'th coordinate to lower bound.
> > QBk:n
> >   scale k'th coordinate to upper bound.
> > QbB
> >   scale input to unit cube centered at the origin.
> > QRn
> >   randomly rotate the input with a random seed of n. If n=0, the seed is the time. If n=-1, use time for the random seed, but do not rotate the input.
> > Qbk:0Bk:0
> >   remove k'th coordinate from input. This computes the convex hull in one lower dimension.

### »qconvex controls

> These options provide additional control:

> > Qt
> >   triangulated output. Qhull triangulates non-simplicial facets. It may produce degenerate facets of zero area.
> > QJ
> >   joggle the input instead of merging facets. This guarantees simplicial facets (e.g., triangles in 3-d).
> > Qc
> >   keep coplanar points
> > Qi
> >   keep interior points
> > f
> >   facet dump. Print the data structure for each facet.
> > QVn
> >   select facets containing point n as a vertex,
> > QGn
> >   select facets that are visible from point n (marked 'good'). Use -n for the remainder.
> > PDk:0
> >   select facets with a negative coordinate for dimension k
> > TFn
> >   report progress after constructing n facets
> > Tv
> >   verify result
> > TI file
> >   input data from file. The filename may not use spaces or quotes.
> > TO file
> >   output results to file. Use single quotes if the filename contains spaces (e.g., `TO 'file with spaces.txt'`
> > Qs
> >   search all points for the initial simplex. If Qhull can not construct an initial simplex, it reports a descriptive message. Usually, the point set is degenerate and one or more dimensions should be removed ('Qbk:0Bk:0'). If not, use option 'Qs'. It performs an exhaustive search for the best initial simplex. This is expensive is high dimensions.

### »qconvex graphics

> Display 2-d, 3-d, and 4-d convex hulls with Geomview ('G').

> Display 2-d and 3-d convex hulls with Mathematica ('m').

> To view 4-d convex hulls in 3-d, use 'Pd0d1d2d3' to select the positive octant and 'GrD2' to drop dimension 2.

### »qconvex notes

> Qhull always computes a convex hull. The convex hull may be used for other geometric structures. The general technique is to transform the structure into an equivalent convex hull problem. For example, the Delaunay triangulation is equivalent to the convex hull of the input sites after lifting the points to a paraboloid.

### »qconvex conventions

> The following terminology is used for convex hulls in Qhull. See Qhull's data structures.

> - point - d coordinates
> - vertex - extreme point of the input set
> - ridge - d-1 vertices between two neighboring facets
> - hyperplane - halfspace defined by a unit normal and offset
> - coplanar point - a nearly incident point to a hyperplane
> - centrum - a point on the hyperplane for testing convexity
> - facet - a facet with vertices, ridges, coplanar points, neighboring facets, and hyperplane
> - simplicial facet - a facet with d vertices, d ridges, and d neighbors
> - non-simplicial facet - a facet with more than d vertices
> - good facet - a facet selected by 'QVn', etc.

### »qconvex options

    qconvex- compute the convex hull
        http://www.geom.umn.edu/software/qhull

    input (stdin):
        first lines: dimension and number of points (or vice-versa).
        other lines: point coordinates, best if one point per line
        comments:    start with a non-numeric character

    options:
        Qt   - triangulated output
        QJ   - joggle input instead of merging facets
        Qc   - keep coplanar points with nearest facet
        Qi   - keep interior points with nearest facet

    Qhull control options:
        Qbk:n   - scale coord k so that low bound is n
          QBk:n - scale coord k so that upper bound is n (QBk is 0.5)
        QbB  - scale input to unit cube centered at the origin
        Qbk:0Bk:0 - remove k-th coordinate from input
        QJn  - randomly joggle input in range [-n,n]
        QRn  - random rotation (n=seed, n=0 time, n=-1 time/no rotate)
        Qs   - search all points for the initial simplex
        QGn  - good facet if visible from point n, -n for not visible
        QVn  - good facet if it includes point n, -n if not

    Trace options:
        T4   - trace at level n, 4=all, 5=mem/gauss, -1= events
        Tc   - check frequently during execution
        Ts   - print statistics
        Tv   - verify result: structure, convexity, and point inclusion
        Tz   - send all output to stdout
        TFn  - report summary when n or more facets created
        TI file - input data from file, no spaces or single quotes
        TO file - output results to file, may be enclosed in single quotes
        TPn  - turn on tracing when point n added to hull
         TMn - turn on tracing at merge n
         TWn - trace merge facets when width > n
        TVn  - stop qhull after adding point n, -n for before (see TCn)
         TCn - stop qhull after building cone for point n (see TVn)

    Precision options:
        Cn   - radius of centrum (roundoff added).  Merge facets if non-convex
         An  - cosine of maximum angle.  Merge facets if cosine > n or non-convex
               C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge
        Rn   - randomly perturb computations by a factor of [1-n,1+n]
        Un   - max distance below plane for a new, coplanar point
        Wn   - min facet width for outside point (before roundoff)

    Output formats (may be combined; if none, produces a summary to stdout):
        f    - facet dump
        G    - Geomview output (see below)
        i    - vertices incident to each facet
        m    - Mathematica output (2-d and 3-d)
        n    - normals with offsets
        o    - OFF file format (dim, points and facets; Voronoi regions)
        p    - point coordinates
        s    - summary (stderr)

    More formats:
        Fa   - area for each facet
        FA   - compute total area and volume for option 's'
        Fc   - count plus coplanar points for each facet
               use 'Qc' (default) for coplanar and 'Qi' for interior
        FC   - centrum for each facet
        Fd   - use cdd format for input (homogeneous with offset first)
        FD   - use cdd format for numeric output (offset first)
        FF   - facet dump without ridges
        Fi   - inner plane for each facet
        FI   - ID for each facet
        Fm   - merge count for each facet (511 max)
        Fn   - count plus neighboring facets for each facet
        FN   - count plus neighboring facets for each point
        Fo   - outer plane (or max_outside) for each facet
        FO   - options and precision constants
        FP   - nearest vertex for each coplanar point
        FQ   - command used for qconvex
        Fs   - summary: #int (8), dimension, #points, tot vertices, tot facets,
                          for output: #vertices, #facets,
                                      #coplanar points, #non-simplicial facets
                        #real (2), max outer plane, min vertex
        FS   - sizes:   #int (0)
                        #real(2) tot area, tot volume
        Ft   - triangulation with centrums for non-simplicial facets (OFF format)
        Fv   - count plus vertices for each facet
        FV   - average of vertices (a feasible point for 'H')
        Fx   - extreme points (in order for 2-d)

    Geomview output (2-d, 3-d, and 4-d)
        Ga   - all points as dots
         Gp  -  coplanar points and vertices as radii
         Gv  -  vertices as spheres
        Gi   - inner planes only
         Gn  -  no planes
         Go  -  outer planes only
        Gc   - centrums
        Gh   - hyperplane intersections
        Gr   - ridges
        GDn  - drop dimension n in 3-d and 4-d output

    Print options:
        PAn  - keep n largest facets by area
        Pdk:n - drop facet if normal[k] <= n (default 0.0)
        PDk:n - drop facet if normal[k] >= n
        Pg   - print good facets (needs 'QGn' or 'QVn')
        PFn  - keep facets whose area is at least n
        PG   - print neighbors of good facets
        PMn  - keep n facets with most merges
        Po   - force output.  If error, output neighborhood of facet
        Pp   - do not report precision problems

        .    - list of all options
        -    - one line descriptions of all options

Up: Home page for Qhull
Up: Qhull manual: Table of Contents
To: Programs •Options • Output • Formats • Geomview • Print • Qhull • Precision • Trace
To: synopsis • input • outputs • controls • graphics • notes • conventions • options

The Geometry Center Home Page

Comments to: qhull@geom.umn.edu
Created: Sept. 25, 1995 --- Last modified: see top