libqhull.h
Go to the documentation of this file.
00001 /*<html><pre>  -<a                             href="qh-qhull.htm"
00002   >-------------------------------</a><a name="TOP">-</a>
00003 
00004    libqhull.h
00005    user-level header file for using qhull.a library
00006 
00007    see qh-qhull.htm, qhull_a.h
00008 
00009    Copyright (c) 1993-2011 The Geometry Center.
00010    $Id: //main/2011/qhull/src/libqhull/libqhull.h#5 $$Change: 1441 $
00011    $DateTime: 2011/11/23 22:39:03 $$Author: bbarber $
00012 
00013    NOTE: access to qh_qh is via the 'qh' macro.  This allows
00014    qh_qh to be either a pointer or a structure.  An example
00015    of using qh is "qh DROPdim" which accesses the DROPdim
00016    field of qh_qh.  Similarly, access to qh_qhstat is via
00017    the 'qhstat' macro.
00018 
00019    includes function prototypes for libqhull.c, geom.c, global.c, io.c, user.c
00020 
00021    use mem.h for mem.c
00022    use qset.h for qset.c
00023 
00024    see unix.c for an example of using libqhull.h
00025 
00026    recompile qhull if you change this file
00027 */
00028 
00029 #ifndef qhDEFlibqhull
00030 #define qhDEFlibqhull 1
00031 
00032 /*=========================== -included files ==============*/
00033 
00034 #include "user.h"      /* user definable constants (e.g., qh_QHpointer) */
00035 
00036 #include <setjmp.h>
00037 #include <float.h>
00038 #include <time.h>
00039 #include <stdio.h>
00040 
00041 #if __MWERKS__ && __POWERPC__
00042 #include  <SIOUX.h>
00043 #include  <Files.h>
00044 #include        <Desk.h>
00045 #endif
00046 
00047 #ifndef __STDC__
00048 #ifndef __cplusplus
00049 #if     !_MSC_VER
00050 #error  Neither __STDC__ nor __cplusplus is defined.  Please use strict ANSI C or C++ to compile
00051 #error  Qhull.  You may need to turn off compiler extensions in your project configuration.  If
00052 #error  your compiler is a standard C compiler, you can delete this warning from libqhull.h
00053 #endif
00054 #endif
00055 #endif
00056 
00057 /*============ constants and basic types ====================*/
00058 
00059 extern const char *qh_version; /* defined in global.c */
00060 
00061 /*-<a                             href="qh-geom.htm#TOC"
00062   >--------------------------------</a><a name="coordT">-</a>
00063 
00064   coordT
00065     coordinates and coefficients are stored as realT (i.e., double)
00066 
00067   notes:
00068     Qhull works well if realT is 'float'.  If so joggle (QJ) is not effective.
00069 
00070     Could use 'float' for data and 'double' for calculations (realT vs. coordT)
00071       This requires many type casts, and adjusted error bounds.
00072       Also C compilers may do expressions in double anyway.
00073 */
00074 #define coordT realT
00075 
00076 /*-<a                             href="qh-geom.htm#TOC"
00077   >--------------------------------</a><a name="pointT">-</a>
00078 
00079   pointT
00080     a point is an array of coordinates, usually qh.hull_dim
00081 */
00082 #define pointT coordT
00083 
00084 /*-<a                             href="qh-qhull.htm#TOC"
00085   >--------------------------------</a><a name="flagT">-</a>
00086 
00087   flagT
00088     Boolean flag as a bit
00089 */
00090 #define flagT unsigned int
00091 
00092 /*-<a                             href="qh-qhull.htm#TOC"
00093   >--------------------------------</a><a name="boolT">-</a>
00094 
00095   boolT
00096     boolean value, either True or False
00097 
00098   notes:
00099     needed for portability
00100     Use qh_False/qh_True as synonyms
00101 */
00102 #define boolT unsigned int
00103 #ifdef False
00104 #undef False
00105 #endif
00106 #ifdef True
00107 #undef True
00108 #endif
00109 #define False 0
00110 #define True 1
00111 #define qh_False 0
00112 #define qh_True 1
00113 
00114 /*-<a                             href="qh-qhull.htm#TOC"
00115   >--------------------------------</a><a name="CENTERtype">-</a>
00116 
00117   qh_CENTER
00118     to distinguish facet->center
00119 */
00120 typedef enum
00121 {
00122     qh_ASnone = 0, qh_ASvoronoi, qh_AScentrum
00123 }
00124 qh_CENTER;
00125 
00126 /*-<a                             href="qh-qhull.htm#TOC"
00127   >--------------------------------</a><a name="qh_PRINT">-</a>
00128 
00129   qh_PRINT
00130     output formats for printing (qh.PRINTout).
00131     'Fa' 'FV' 'Fc' 'FC'
00132 
00133 
00134    notes:
00135    some of these names are similar to qh names.  The similar names are only
00136    used in switch statements in qh_printbegin() etc.
00137 */
00138 typedef enum {qh_PRINTnone= 0,
00139   qh_PRINTarea, qh_PRINTaverage,           /* 'Fa' 'FV' 'Fc' 'FC' */
00140   qh_PRINTcoplanars, qh_PRINTcentrums,
00141   qh_PRINTfacets, qh_PRINTfacets_xridge,   /* 'f' 'FF' 'G' 'FI' 'Fi' 'Fn' */
00142   qh_PRINTgeom, qh_PRINTids, qh_PRINTinner, qh_PRINTneighbors,
00143   qh_PRINTnormals, qh_PRINTouter, qh_PRINTmaple, /* 'n' 'Fo' 'i' 'm' 'Fm' 'FM', 'o' */
00144   qh_PRINTincidences, qh_PRINTmathematica, qh_PRINTmerges, qh_PRINToff,
00145   qh_PRINToptions, qh_PRINTpointintersect, /* 'FO' 'Fp' 'FP' 'p' 'FQ' 'FS' */
00146   qh_PRINTpointnearest, qh_PRINTpoints, qh_PRINTqhull, qh_PRINTsize,
00147   qh_PRINTsummary, qh_PRINTtriangles,      /* 'Fs' 'Ft' 'Fv' 'FN' 'Fx' */
00148   qh_PRINTvertices, qh_PRINTvneighbors, qh_PRINTextremes,
00149   qh_PRINTEND} qh_PRINT;
00150 
00151 /*-<a                             href="qh-qhull.htm#TOC"
00152   >--------------------------------</a><a name="qh_ALL">-</a>
00153 
00154   qh_ALL
00155     argument flag for selecting everything
00156 */
00157 #define qh_ALL      True
00158 #define qh_NOupper  True     /* argument for qh_findbest */
00159 #define qh_IScheckmax  True     /* argument for qh_findbesthorizon */
00160 #define qh_ISnewfacets  True     /* argument for qh_findbest */
00161 #define qh_RESETvisible  True     /* argument for qh_resetlists */
00162 
00163 /*-<a                             href="qh-qhull.htm#TOC"
00164   >--------------------------------</a><a name="qh_ERR">-</a>
00165 
00166   qh_ERR
00167     Qhull exit codes, for indicating errors
00168     See: MSG_ERROR and MSG_WARNING [user.h]
00169 */
00170 #define qh_ERRnone  0    /* no error occurred during qhull */
00171 #define qh_ERRinput 1    /* input inconsistency */
00172 #define qh_ERRsingular 2 /* singular input data */
00173 #define qh_ERRprec  3    /* precision error */
00174 #define qh_ERRmem   4    /* insufficient memory, matches mem.h */
00175 #define qh_ERRqhull 5    /* internal error detected, matches mem.h */
00176 
00177 /*-<a                             href="qh-qhull.htm#TOC"
00178 >--------------------------------</a><a name="qh_FILEstderr">-</a>
00179 
00180 qh_FILEstderr
00181 Fake stderr to distinguish error output from normal output
00182 For C++ interface.  Must redefine qh_fprintf_qhull
00183 */
00184 #define qh_FILEstderr (FILE*)1
00185 
00186 /* ============ -structures- ====================
00187    each of the following structures is defined by a typedef
00188    all realT and coordT fields occur at the beginning of a structure
00189         (otherwise space may be wasted due to alignment)
00190    define all flags together and pack into 32-bit number
00191 */
00192 
00193 typedef struct vertexT vertexT;
00194 typedef struct ridgeT ridgeT;
00195 typedef struct facetT facetT;
00196 #ifndef DEFsetT
00197 #define DEFsetT 1
00198 typedef struct setT setT;          /* defined in qset.h */
00199 #endif
00200 
00201 #ifndef DEFqhstatT
00202 #define DEFqhstatT 1
00203 typedef struct qhstatT qhstatT;    /* defined in stat.h */
00204 #endif
00205 
00206 /*-<a                             href="qh-poly.htm#TOC"
00207   >--------------------------------</a><a name="facetT">-</a>
00208 
00209   facetT
00210     defines a facet
00211 
00212   notes:
00213    qhull() generates the hull as a list of facets.
00214 
00215   topological information:
00216     f.previous,next     doubly-linked list of facets
00217     f.vertices          set of vertices
00218     f.ridges            set of ridges
00219     f.neighbors         set of neighbors
00220     f.toporient         True if facet has top-orientation (else bottom)
00221 
00222   geometric information:
00223     f.offset,normal     hyperplane equation
00224     f.maxoutside        offset to outer plane -- all points inside
00225     f.center            centrum for testing convexity
00226     f.simplicial        True if facet is simplicial
00227     f.flipped           True if facet does not include qh.interior_point
00228 
00229   for constructing hull:
00230     f.visible           True if facet on list of visible facets (will be deleted)
00231     f.newfacet          True if facet on list of newly created facets
00232     f.coplanarset       set of points coplanar with this facet
00233                         (includes near-inside points for later testing)
00234     f.outsideset        set of points outside of this facet
00235     f.furthestdist      distance to furthest point of outside set
00236     f.visitid           marks visited facets during a loop
00237     f.replace           replacement facet for to-be-deleted, visible facets
00238     f.samecycle,newcycle cycle of facets for merging into horizon facet
00239 
00240   see below for other flags and fields
00241 */
00242 struct facetT {
00243 #if !qh_COMPUTEfurthest
00244   coordT   furthestdist;/* distance to furthest point of outsideset */
00245 #endif
00246 #if qh_MAXoutside
00247   coordT   maxoutside;  /* max computed distance of point to facet
00248                         Before QHULLfinished this is an approximation
00249                         since maxdist not always set for mergefacet
00250                         Actual outer plane is +DISTround and
00251                         computed outer plane is +2*DISTround */
00252 #endif
00253   coordT   offset;      /* exact offset of hyperplane from origin */
00254   coordT  *normal;      /* normal of hyperplane, hull_dim coefficients */
00255                         /*   if tricoplanar, shared with a neighbor */
00256   union {               /* in order of testing */
00257    realT   area;        /* area of facet, only in io.c if  ->isarea */
00258    facetT *replace;     /*  replacement facet if ->visible and NEWfacets
00259                              is NULL only if qh_mergedegen_redundant or interior */
00260    facetT *samecycle;   /*  cycle of facets from the same visible/horizon intersection,
00261                              if ->newfacet */
00262    facetT *newcycle;    /*  in horizon facet, current samecycle of new facets */
00263    facetT *trivisible;  /* visible facet for ->tricoplanar facets during qh_triangulate() */
00264    facetT *triowner;    /* owner facet for ->tricoplanar, !isarea facets w/ ->keepcentrum */
00265   }f;
00266   coordT  *center;      /*  centrum for convexity, qh CENTERtype == qh_AScentrum */
00267                         /*  Voronoi center, qh CENTERtype == qh_ASvoronoi */
00268                         /*   if tricoplanar, shared with a neighbor */
00269   facetT  *previous;    /* previous facet in the facet_list */
00270   facetT  *next;        /* next facet in the facet_list */
00271   setT    *vertices;    /* vertices for this facet, inverse sorted by ID
00272                            if simplicial, 1st vertex was apex/furthest */
00273   setT    *ridges;      /* explicit ridges for nonsimplicial facets.
00274                            for simplicial facets, neighbors define the ridges */
00275   setT    *neighbors;   /* neighbors of the facet.  If simplicial, the kth
00276                            neighbor is opposite the kth vertex, and the first
00277                            neighbor is the horizon facet for the first vertex*/
00278   setT    *outsideset;  /* set of points outside this facet
00279                            if non-empty, last point is furthest
00280                            if NARROWhull, includes coplanars for partitioning*/
00281   setT    *coplanarset; /* set of points coplanar with this facet
00282                            > qh.min_vertex and <= facet->max_outside
00283                            a point is assigned to the furthest facet
00284                            if non-empty, last point is furthest away */
00285   unsigned visitid;     /* visit_id, for visiting all neighbors,
00286                            all uses are independent */
00287   unsigned id;          /* unique identifier from qh facet_id */
00288   unsigned nummerge:9;  /* number of merges */
00289 #define qh_MAXnummerge 511 /*     2^9-1, 32 flags total, see "flags:" in io.c */
00290   flagT    tricoplanar:1; /* True if TRIangulate and simplicial and coplanar with a neighbor */
00291                           /*   all tricoplanars share the same ->center, ->normal, ->offset, ->maxoutside */
00292                           /*   all tricoplanars share the same apex */
00293                           /*   if ->degenerate, does not span facet (one logical ridge) */
00294                           /*   one tricoplanar has ->keepcentrum and ->coplanarset */
00295                           /*   during qh_triangulate, f.trivisible points to original facet */
00296   flagT    newfacet:1;  /* True if facet on qh newfacet_list (new or merged) */
00297   flagT    visible:1;   /* True if visible facet (will be deleted) */
00298   flagT    toporient:1; /* True if created with top orientation
00299                            after merging, use ridge orientation */
00300   flagT    simplicial:1;/* True if simplicial facet, ->ridges may be implicit */
00301   flagT    seen:1;      /* used to perform operations only once, like visitid */
00302   flagT    seen2:1;     /* used to perform operations only once, like visitid */
00303   flagT    flipped:1;   /* True if facet is flipped */
00304   flagT    upperdelaunay:1; /* True if facet is upper envelope of Delaunay triangulation */
00305   flagT    notfurthest:1; /* True if last point of outsideset is not furthest*/
00306 
00307 /*-------- flags primarily for output ---------*/
00308   flagT    good:1;      /* True if a facet marked good for output */
00309   flagT    isarea:1;    /* True if facet->f.area is defined */
00310 
00311 /*-------- flags for merging ------------------*/
00312   flagT    dupridge:1;  /* True if duplicate ridge in facet */
00313   flagT    mergeridge:1; /* True if facet or neighbor contains a qh_MERGEridge
00314                             ->normal defined (also defined for mergeridge2) */
00315   flagT    mergeridge2:1; /* True if neighbor contains a qh_MERGEridge (mark_dupridges */
00316   flagT    coplanar:1;  /* True if horizon facet is coplanar at last use */
00317   flagT     mergehorizon:1; /* True if will merge into horizon (->coplanar) */
00318   flagT     cycledone:1;/* True if mergecycle_all already done */
00319   flagT    tested:1;    /* True if facet convexity has been tested (false after merge */
00320   flagT    keepcentrum:1; /* True if keep old centrum after a merge, or marks owner for ->tricoplanar */
00321   flagT    newmerge:1;  /* True if facet is newly merged for reducevertices */
00322   flagT    degenerate:1; /* True if facet is degenerate (degen_mergeset or ->tricoplanar) */
00323   flagT    redundant:1;  /* True if facet is redundant (degen_mergeset) */
00324 };
00325 
00326 
00327 /*-<a                             href="qh-poly.htm#TOC"
00328   >--------------------------------</a><a name="ridgeT">-</a>
00329 
00330   ridgeT
00331     defines a ridge
00332 
00333   notes:
00334   a ridge is hull_dim-1 simplex between two neighboring facets.  If the
00335   facets are non-simplicial, there may be more than one ridge between
00336   two facets.  E.G. a 4-d hypercube has two triangles between each pair
00337   of neighboring facets.
00338 
00339   topological information:
00340     vertices            a set of vertices
00341     top,bottom          neighboring facets with orientation
00342 
00343   geometric information:
00344     tested              True if ridge is clearly convex
00345     nonconvex           True if ridge is non-convex
00346 */
00347 struct ridgeT {
00348   setT    *vertices;    /* vertices belonging to this ridge, inverse sorted by ID
00349                            NULL if a degen ridge (matchsame) */
00350   facetT  *top;         /* top facet this ridge is part of */
00351   facetT  *bottom;      /* bottom facet this ridge is part of */
00352   unsigned id:24;       /* unique identifier, =>room for 8 flags, bit field matches qh.ridge_id */
00353   flagT    seen:1;      /* used to perform operations only once */
00354   flagT    tested:1;    /* True when ridge is tested for convexity */
00355   flagT    nonconvex:1; /* True if getmergeset detected a non-convex neighbor
00356                            only one ridge between neighbors may have nonconvex */
00357 };
00358 
00359 /*-<a                             href="qh-poly.htm#TOC"
00360   >--------------------------------</a><a name="vertexT">-</a>
00361 
00362   vertexT
00363      defines a vertex
00364 
00365   topological information:
00366     next,previous       doubly-linked list of all vertices
00367     neighbors           set of adjacent facets (only if qh.VERTEXneighbors)
00368 
00369   geometric information:
00370     point               array of DIM3 coordinates
00371 */
00372 struct vertexT {
00373   vertexT *next;        /* next vertex in vertex_list */
00374   vertexT *previous;    /* previous vertex in vertex_list */
00375   pointT  *point;       /* hull_dim coordinates (coordT) */
00376   setT    *neighbors;   /* neighboring facets of vertex, qh_vertexneighbors()
00377                            inits in io.c or after first merge */
00378   unsigned visitid:31;  /* for use with qh vertex_visit, size must match */
00379   flagT    seen2:1;     /* another seen flag */
00380   unsigned id:24;       /* unique identifier, bit field matches qh.vertex_id */
00381   unsigned dim:4;       /* dimension of point if non-zero, used by cpp */
00382                         /* =>room for 4 flags */
00383   flagT    seen:1;      /* used to perform operations only once */
00384   flagT    delridge:1;  /* vertex was part of a deleted ridge */
00385   flagT    deleted:1;   /* true if vertex on qh del_vertices */
00386   flagT    newlist:1;   /* true if vertex on qh newvertex_list */
00387 };
00388 
00389 #define MAX_vdim 15  /* Maximum size of vertex->dim */
00390 
00391 /*======= -global variables -qh ============================*/
00392 
00393 /*-<a                             href="qh-globa.htm#TOC"
00394   >--------------------------------</a><a name="qh">-</a>
00395 
00396   qh
00397    all global variables for qhull are in qh, qhmem, and qhstat
00398 
00399   notes:
00400    qhmem is defined in mem.h, qhstat is defined in stat.h, qhrbox is defined in rboxpoints.h
00401    Access to qh_qh is via the "qh" macro.  See qh_QHpointer in user.h
00402 
00403    All global variables for qhull are in qh, qhmem, and qhstat
00404    qh must be unique for each instance of qhull
00405    qhstat may be shared between qhull instances.
00406    qhmem may be shared across multiple instances of Qhull.
00407    Rbox uses global variables rbox_inuse and rbox, but does not persist data across calls.
00408 
00409    Qhull is not multithreaded.  Global state could be stored in thread-local storage.
00410 */
00411 
00412 extern int qhull_inuse;
00413 
00414 typedef struct qhT qhT;
00415 #if qh_QHpointer_dllimport
00416 #define qh qh_qh->
00417 __declspec(dllimport) extern qhT *qh_qh;     /* allocated in global.c */
00418 #elif qh_QHpointer
00419 #define qh qh_qh->
00420 extern qhT *qh_qh;     /* allocated in global.c */
00421 #else
00422 #define qh qh_qh.
00423 extern qhT qh_qh;
00424 #endif
00425 
00426 struct qhT {
00427 
00428 /*-<a                             href="qh-globa.htm#TOC"
00429   >--------------------------------</a><a name="qh-const">-</a>
00430 
00431   qh constants
00432     configuration flags and constants for Qhull
00433 
00434   notes:
00435     The user configures Qhull by defining flags.  They are
00436     copied into qh by qh_setflags().  qh-quick.htm#options defines the flags.
00437 */
00438   boolT ALLpoints;        /* true 'Qs' if search all points for initial simplex */
00439   boolT ANGLEmerge;       /* true 'Qa' if sort potential merges by angle */
00440   boolT APPROXhull;       /* true 'Wn' if MINoutside set */
00441   realT   MINoutside;     /*   'Wn' min. distance for an outside point */
00442   boolT ANNOTATEoutput;   /* true 'Ta' if annotate output with message codes */
00443   boolT ATinfinity;       /* true 'Qz' if point num_points-1 is "at-infinity"
00444                              for improving precision in Delaunay triangulations */
00445   boolT AVOIDold;         /* true 'Q4' if avoid old->new merges */
00446   boolT BESToutside;      /* true 'Qf' if partition points into best outsideset */
00447   boolT CDDinput;         /* true 'Pc' if input uses CDD format (1.0/offset first) */
00448   boolT CDDoutput;        /* true 'PC' if print normals in CDD format (offset first) */
00449   boolT CHECKfrequently;  /* true 'Tc' if checking frequently */
00450   realT premerge_cos;     /*   'A-n'   cos_max when pre merging */
00451   realT postmerge_cos;    /*   'An'    cos_max when post merging */
00452   boolT DELAUNAY;         /* true 'd' if computing DELAUNAY triangulation */
00453   boolT DOintersections;  /* true 'Gh' if print hyperplane intersections */
00454   int   DROPdim;          /* drops dim 'GDn' for 4-d -> 3-d output */
00455   boolT FORCEoutput;      /* true 'Po' if forcing output despite degeneracies */
00456   int   GOODpoint;        /* 1+n for 'QGn', good facet if visible/not(-) from point n*/
00457   pointT *GOODpointp;     /*   the actual point */
00458   boolT GOODthreshold;    /* true if qh lower_threshold/upper_threshold defined
00459                              false if qh SPLITthreshold */
00460   int   GOODvertex;       /* 1+n, good facet if vertex for point n */
00461   pointT *GOODvertexp;     /*   the actual point */
00462   boolT HALFspace;        /* true 'Hn,n,n' if halfspace intersection */
00463   int   IStracing;        /* trace execution, 0=none, 1=least, 4=most, -1=events */
00464   int   KEEParea;         /* 'PAn' number of largest facets to keep */
00465   boolT KEEPcoplanar;     /* true 'Qc' if keeping nearest facet for coplanar points */
00466   boolT KEEPinside;       /* true 'Qi' if keeping nearest facet for inside points
00467                               set automatically if 'd Qc' */
00468   int   KEEPmerge;        /* 'PMn' number of facets to keep with most merges */
00469   realT KEEPminArea;      /* 'PFn' minimum facet area to keep */
00470   realT MAXcoplanar;      /* 'Un' max distance below a facet to be coplanar*/
00471   boolT MERGEexact;       /* true 'Qx' if exact merges (coplanar, degen, dupridge, flipped) */
00472   boolT MERGEindependent; /* true 'Q2' if merging independent sets */
00473   boolT MERGING;          /* true if exact-, pre- or post-merging, with angle and centrum tests */
00474   realT   premerge_centrum;  /*   'C-n' centrum_radius when pre merging.  Default is round-off */
00475   realT   postmerge_centrum; /*   'Cn' centrum_radius when post merging.  Default is round-off */
00476   boolT MERGEvertices;    /* true 'Q3' if merging redundant vertices */
00477   realT MINvisible;       /* 'Vn' min. distance for a facet to be visible */
00478   boolT NOnarrow;         /* true 'Q10' if no special processing for narrow distributions */
00479   boolT NOnearinside;     /* true 'Q8' if ignore near-inside points when partitioning */
00480   boolT NOpremerge;       /* true 'Q0' if no defaults for C-0 or Qx */
00481   boolT ONLYgood;         /* true 'Qg' if process points with good visible or horizon facets */
00482   boolT ONLYmax;          /* true 'Qm' if only process points that increase max_outside */
00483   boolT PICKfurthest;     /* true 'Q9' if process furthest of furthest points*/
00484   boolT POSTmerge;        /* true if merging after buildhull (Cn or An) */
00485   boolT PREmerge;         /* true if merging during buildhull (C-n or A-n) */
00486                         /* NOTE: some of these names are similar to qh_PRINT names */
00487   boolT PRINTcentrums;    /* true 'Gc' if printing centrums */
00488   boolT PRINTcoplanar;    /* true 'Gp' if printing coplanar points */
00489   int   PRINTdim;         /* print dimension for Geomview output */
00490   boolT PRINTdots;        /* true 'Ga' if printing all points as dots */
00491   boolT PRINTgood;        /* true 'Pg' if printing good facets */
00492   boolT PRINTinner;       /* true 'Gi' if printing inner planes */
00493   boolT PRINTneighbors;   /* true 'PG' if printing neighbors of good facets */
00494   boolT PRINTnoplanes;    /* true 'Gn' if printing no planes */
00495   boolT PRINToptions1st;  /* true 'FO' if printing options to stderr */
00496   boolT PRINTouter;       /* true 'Go' if printing outer planes */
00497   boolT PRINTprecision;   /* false 'Pp' if not reporting precision problems */
00498   qh_PRINT PRINTout[qh_PRINTEND]; /* list of output formats to print */
00499   boolT PRINTridges;      /* true 'Gr' if print ridges */
00500   boolT PRINTspheres;     /* true 'Gv' if print vertices as spheres */
00501   boolT PRINTstatistics;  /* true 'Ts' if printing statistics to stderr */
00502   boolT PRINTsummary;     /* true 's' if printing summary to stderr */
00503   boolT PRINTtransparent; /* true 'Gt' if print transparent outer ridges */
00504   boolT PROJECTdelaunay;  /* true if DELAUNAY, no readpoints() and
00505                              need projectinput() for Delaunay in qh_init_B */
00506   int   PROJECTinput;     /* number of projected dimensions 'bn:0Bn:0' */
00507   boolT QUICKhelp;        /* true if quick help message for degen input */
00508   boolT RANDOMdist;       /* true if randomly change distplane and setfacetplane */
00509   realT RANDOMfactor;     /*    maximum random perturbation */
00510   realT RANDOMa;          /*    qh_randomfactor is randr * RANDOMa + RANDOMb */
00511   realT RANDOMb;
00512   boolT RANDOMoutside;    /* true if select a random outside point */
00513   int   REPORTfreq;       /* buildtracing reports every n facets */
00514   int   REPORTfreq2;      /* tracemerging reports every REPORTfreq/2 facets */
00515   int   RERUN;            /* 'TRn' rerun qhull n times (qh.build_cnt) */
00516   int   ROTATErandom;     /* 'QRn' seed, 0 time, >= rotate input */
00517   boolT SCALEinput;       /* true 'Qbk' if scaling input */
00518   boolT SCALElast;        /* true 'Qbb' if scale last coord to max prev coord */
00519   boolT SETroundoff;      /* true 'E' if qh DISTround is predefined */
00520   boolT SKIPcheckmax;     /* true 'Q5' if skip qh_check_maxout */
00521   boolT SKIPconvex;       /* true 'Q6' if skip convexity testing during pre-merge */
00522   boolT SPLITthresholds;  /* true if upper_/lower_threshold defines a region
00523                                used only for printing (!for qh ONLYgood) */
00524   int   STOPcone;         /* 'TCn' 1+n for stopping after cone for point n */
00525                           /*       also used by qh_build_withresart for err exit*/
00526   int   STOPpoint;        /* 'TVn' 'TV-n' 1+n for stopping after/before(-)
00527                                         adding point n */
00528   int   TESTpoints;       /* 'QTn' num of test points after qh.num_points.  Test points always coplanar. */
00529   boolT TESTvneighbors;   /*  true 'Qv' if test vertex neighbors at end */
00530   int   TRACElevel;       /* 'Tn' conditional IStracing level */
00531   int   TRACElastrun;     /*  qh.TRACElevel applies to last qh.RERUN */
00532   int   TRACEpoint;       /* 'TPn' start tracing when point n is a vertex */
00533   realT TRACEdist;        /* 'TWn' start tracing when merge distance too big */
00534   int   TRACEmerge;       /* 'TMn' start tracing before this merge */
00535   boolT TRIangulate;      /* true 'Qt' if triangulate non-simplicial facets */
00536   boolT TRInormals;       /* true 'Q11' if triangulate duplicates normals (sets Qt) */
00537   boolT UPPERdelaunay;    /* true 'Qu' if computing furthest-site Delaunay */
00538   boolT USEstdout;        /* true 'Tz' if using stdout instead of stderr */
00539   boolT VERIFYoutput;     /* true 'Tv' if verify output at end of qhull */
00540   boolT VIRTUALmemory;    /* true 'Q7' if depth-first processing in buildhull */
00541   boolT VORONOI;          /* true 'v' if computing Voronoi diagram */
00542 
00543   /*--------input constants ---------*/
00544   realT AREAfactor;       /* 1/(hull_dim-1)! for converting det's to area */
00545   boolT DOcheckmax;       /* true if calling qh_check_maxout (qh_initqhull_globals) */
00546   char  *feasible_string;  /* feasible point 'Hn,n,n' for halfspace intersection */
00547   coordT *feasible_point;  /*    as coordinates, both malloc'd */
00548   boolT GETarea;          /* true 'Fa', 'FA', 'FS', 'PAn', 'PFn' if compute facet area/Voronoi volume in io.c */
00549   boolT KEEPnearinside;   /* true if near-inside points in coplanarset */
00550   int   hull_dim;         /* dimension of hull, set by initbuffers */
00551   int   input_dim;        /* dimension of input, set by initbuffers */
00552   int   num_points;       /* number of input points */
00553   pointT *first_point;    /* array of input points, see POINTSmalloc */
00554   boolT POINTSmalloc;     /*   true if qh first_point/num_points allocated */
00555   pointT *input_points;   /* copy of original qh.first_point for input points for qh_joggleinput */
00556   boolT input_malloc;     /* true if qh input_points malloc'd */
00557   char  qhull_command[256];/* command line that invoked this program */
00558   int   qhull_commandsiz2; /*    size of qhull_command at qh_clear_outputflags */
00559   char  rbox_command[256]; /* command line that produced the input points */
00560   char  qhull_options[512];/* descriptive list of options */
00561   int   qhull_optionlen;  /*    length of last line */
00562   int   qhull_optionsiz;  /*    size of qhull_options at qh_build_withrestart */
00563   int   qhull_optionsiz2; /*    size of qhull_options at qh_clear_outputflags */
00564   int   run_id;           /* non-zero, random identifier for this instance of qhull */
00565   boolT VERTEXneighbors;  /* true if maintaining vertex neighbors */
00566   boolT ZEROcentrum;      /* true if 'C-0' or 'C-0 Qx'.  sets ZEROall_ok */
00567   realT *upper_threshold; /* don't print if facet->normal[k]>=upper_threshold[k]
00568                              must set either GOODthreshold or SPLITthreshold
00569                              if Delaunay, default is 0.0 for upper envelope */
00570   realT *lower_threshold; /* don't print if facet->normal[k] <=lower_threshold[k] */
00571   realT *upper_bound;     /* scale point[k] to new upper bound */
00572   realT *lower_bound;     /* scale point[k] to new lower bound
00573                              project if both upper_ and lower_bound == 0 */
00574 
00575 /*-<a                             href="qh-globa.htm#TOC"
00576   >--------------------------------</a><a name="qh-prec">-</a>
00577 
00578   qh precision constants
00579     precision constants for Qhull
00580 
00581   notes:
00582     qh_detroundoff() computes the maximum roundoff error for distance
00583     and other computations.  It also sets default values for the
00584     qh constants above.
00585 */
00586   realT ANGLEround;       /* max round off error for angles */
00587   realT centrum_radius;   /* max centrum radius for convexity (roundoff added) */
00588   realT cos_max;          /* max cosine for convexity (roundoff added) */
00589   realT DISTround;        /* max round off error for distances, 'E' overrides */
00590   realT MAXabs_coord;     /* max absolute coordinate */
00591   realT MAXlastcoord;     /* max last coordinate for qh_scalelast */
00592   realT MAXsumcoord;      /* max sum of coordinates */
00593   realT MAXwidth;         /* max rectilinear width of point coordinates */
00594   realT MINdenom_1;       /* min. abs. value for 1/x */
00595   realT MINdenom;         /*    use divzero if denominator < MINdenom */
00596   realT MINdenom_1_2;     /* min. abs. val for 1/x that allows normalization */
00597   realT MINdenom_2;       /*    use divzero if denominator < MINdenom_2 */
00598   realT MINlastcoord;     /* min. last coordinate for qh_scalelast */
00599   boolT NARROWhull;       /* set in qh_initialhull if angle < qh_MAXnarrow */
00600   realT *NEARzero;        /* hull_dim array for near zero in gausselim */
00601   realT NEARinside;       /* keep points for qh_check_maxout if close to facet */
00602   realT ONEmerge;         /* max distance for merging simplicial facets */
00603   realT outside_err;      /* application's epsilon for coplanar points
00604                              qh_check_bestdist() qh_check_points() reports error if point outside */
00605   realT WIDEfacet;        /* size of wide facet for skipping ridge in
00606                              area computation and locking centrum */
00607 
00608 /*-<a                             href="qh-globa.htm#TOC"
00609   >--------------------------------</a><a name="qh-codetern">-</a>
00610 
00611   qh internal constants
00612     internal constants for Qhull
00613 */
00614   char qhull[sizeof("qhull")]; /* "qhull" for checking ownership while debugging */
00615   jmp_buf errexit;        /* exit label for qh_errexit, defined by setjmp() */
00616   char jmpXtra[40];       /* extra bytes in case jmp_buf is defined wrong by compiler */
00617   jmp_buf restartexit;    /* restart label for qh_errexit, defined by setjmp() */
00618   char jmpXtra2[40];      /* extra bytes in case jmp_buf is defined wrong by compiler*/
00619   FILE *fin;              /* pointer to input file, init by qh_meminit */
00620   FILE *fout;             /* pointer to output file */
00621   FILE *ferr;             /* pointer to error file */
00622   pointT *interior_point; /* center point of the initial simplex*/
00623   int normal_size;     /* size in bytes for facet normals and point coords*/
00624   int center_size;     /* size in bytes for Voronoi centers */
00625   int   TEMPsize;         /* size for small, temporary sets (in quick mem) */
00626 
00627 /*-<a                             href="qh-globa.htm#TOC"
00628   >--------------------------------</a><a name="qh-lists">-</a>
00629 
00630   qh facet and vertex lists
00631     defines lists of facets, new facets, visible facets, vertices, and
00632     new vertices.  Includes counts, next ids, and trace ids.
00633   see:
00634     qh_resetlists()
00635 */
00636   facetT *facet_list;     /* first facet */
00637   facetT  *facet_tail;     /* end of facet_list (dummy facet) */
00638   facetT *facet_next;     /* next facet for buildhull()
00639                              previous facets do not have outside sets
00640                              NARROWhull: previous facets may have coplanar outside sets for qh_outcoplanar */
00641   facetT *newfacet_list;  /* list of new facets to end of facet_list */
00642   facetT *visible_list;   /* list of visible facets preceeding newfacet_list,
00643                              facet->visible set */
00644   int       num_visible;  /* current number of visible facets */
00645   unsigned tracefacet_id;  /* set at init, then can print whenever */
00646   facetT *tracefacet;     /*   set in newfacet/mergefacet, undone in delfacet*/
00647   unsigned tracevertex_id;  /* set at buildtracing, can print whenever */
00648   vertexT *tracevertex;     /*   set in newvertex, undone in delvertex*/
00649   vertexT *vertex_list;     /* list of all vertices, to vertex_tail */
00650   vertexT  *vertex_tail;    /*      end of vertex_list (dummy vertex) */
00651   vertexT *newvertex_list; /* list of vertices in newfacet_list, to vertex_tail
00652                              all vertices have 'newlist' set */
00653   int   num_facets;       /* number of facets in facet_list
00654                              includes visble faces (num_visible) */
00655   int   num_vertices;     /* number of vertices in facet_list */
00656   int   num_outside;      /* number of points in outsidesets (for tracing and RANDOMoutside)
00657                                includes coplanar outsideset points for NARROWhull/qh_outcoplanar() */
00658   int   num_good;         /* number of good facets (after findgood_all) */
00659   unsigned facet_id;      /* ID of next, new facet from newfacet() */
00660   unsigned ridge_id:24;   /* ID of next, new ridge from newridge() */
00661   unsigned vertex_id:24;  /* ID of next, new vertex from newvertex() */
00662 
00663 /*-<a                             href="qh-globa.htm#TOC"
00664   >--------------------------------</a><a name="qh-var">-</a>
00665 
00666   qh global variables
00667     defines minimum and maximum distances, next visit ids, several flags,
00668     and other global variables.
00669     initialize in qh_initbuild or qh_maxmin if used in qh_buildhull
00670 */
00671   unsigned long hulltime; /* ignore time to set up input and randomize */
00672                           /*   use unsigned to avoid wrap-around errors */
00673   boolT ALLOWrestart;     /* true if qh_precision can use qh.restartexit */
00674   int   build_cnt;        /* number of calls to qh_initbuild */
00675   qh_CENTER CENTERtype;   /* current type of facet->center, qh_CENTER */
00676   int   furthest_id;      /* pointid of furthest point, for tracing */
00677   facetT *GOODclosest;    /* closest facet to GOODthreshold in qh_findgood */
00678   boolT hasAreaVolume;    /* true if totarea, totvol was defined by qh_getarea */
00679   boolT hasTriangulation; /* true if triangulation created by qh_triangulate */
00680   realT JOGGLEmax;        /* set 'QJn' if randomly joggle input */
00681   boolT maxoutdone;       /* set qh_check_maxout(), cleared by qh_addpoint() */
00682   realT max_outside;      /* maximum distance from a point to a facet,
00683                                before roundoff, not simplicial vertices
00684                                actual outer plane is +DISTround and
00685                                computed outer plane is +2*DISTround */
00686   realT max_vertex;       /* maximum distance (>0) from vertex to a facet,
00687                                before roundoff, due to a merge */
00688   realT min_vertex;       /* minimum distance (<0) from vertex to a facet,
00689                                before roundoff, due to a merge
00690                                if qh.JOGGLEmax, qh_makenewplanes sets it
00691                                recomputed if qh.DOcheckmax, default -qh.DISTround */
00692   boolT NEWfacets;        /* true while visible facets invalid due to new or merge
00693                               from makecone/attachnewfacets to deletevisible */
00694   boolT findbestnew;      /* true if partitioning calls qh_findbestnew */
00695   boolT findbest_notsharp; /* true if new facets are at least 90 degrees */
00696   boolT NOerrexit;        /* true if qh.errexit is not available */
00697   realT PRINTcradius;     /* radius for printing centrums */
00698   realT PRINTradius;      /* radius for printing vertex spheres and points */
00699   boolT POSTmerging;      /* true when post merging */
00700   int   printoutvar;      /* temporary variable for qh_printbegin, etc. */
00701   int   printoutnum;      /* number of facets printed */
00702   boolT QHULLfinished;    /* True after qhull() is finished */
00703   realT totarea;          /* 'FA': total facet area computed by qh_getarea, hasAreaVolume */
00704   realT totvol;           /* 'FA': total volume computed by qh_getarea, hasAreaVolume */
00705   unsigned int visit_id;  /* unique ID for searching neighborhoods, */
00706   unsigned int vertex_visit:31; /* unique ID for searching vertices, reset with qh_buildtracing */
00707   boolT ZEROall_ok;       /* True if qh_checkzero always succeeds */
00708   boolT WAScoplanar;      /* True if qh_partitioncoplanar (qh_check_maxout) */
00709 
00710 /*-<a                             href="qh-globa.htm#TOC"
00711   >--------------------------------</a><a name="qh-set">-</a>
00712 
00713   qh global sets
00714     defines sets for merging, initial simplex, hashing, extra input points,
00715     and deleted vertices
00716 */
00717   setT *facet_mergeset;   /* temporary set of merges to be done */
00718   setT *degen_mergeset;   /* temporary set of degenerate and redundant merges */
00719   setT *hash_table;       /* hash table for matching ridges in qh_matchfacets
00720                              size is setsize() */
00721   setT *other_points;     /* additional points */
00722   setT *del_vertices;     /* vertices to partition and delete with visible
00723                              facets.  Have deleted set for checkfacet */
00724 
00725 /*-<a                             href="qh-globa.htm#TOC"
00726   >--------------------------------</a><a name="qh-buf">-</a>
00727 
00728   qh global buffers
00729     defines buffers for maxtrix operations, input, and error messages
00730 */
00731   coordT *gm_matrix;      /* (dim+1)Xdim matrix for geom.c */
00732   coordT **gm_row;        /* array of gm_matrix rows */
00733   char* line;             /* malloc'd input line of maxline+1 chars */
00734   int maxline;
00735   coordT *half_space;     /* malloc'd input array for halfspace (qh normal_size+coordT) */
00736   coordT *temp_malloc;    /* malloc'd input array for points */
00737 
00738 /*-<a                             href="qh-globa.htm#TOC"
00739   >--------------------------------</a><a name="qh-static">-</a>
00740 
00741   qh static variables
00742     defines static variables for individual functions
00743 
00744   notes:
00745     do not use 'static' within a function.  Multiple instances of qhull
00746     may exist.
00747 
00748     do not assume zero initialization, 'QPn' may cause a restart
00749 */
00750   boolT ERREXITcalled;    /* true during qh_errexit (prevents duplicate calls */
00751   boolT firstcentrum;     /* for qh_printcentrum */
00752   boolT old_randomdist;   /* save RANDOMdist flag during io, tracing, or statistics */
00753   setT *coplanarfacetset;  /* set of coplanar facets for searching qh_findbesthorizon() */
00754   realT last_low;         /* qh_scalelast parameters for qh_setdelaunay */
00755   realT last_high;
00756   realT last_newhigh;
00757   unsigned lastreport;    /* for qh_buildtracing */
00758   int mergereport;        /* for qh_tracemerging */
00759   qhstatT *old_qhstat;    /* for saving qh_qhstat in save_qhull() and UsingLibQhull.  Free with qh_free() */
00760   setT *old_tempstack;    /* for saving qhmem.tempstack in save_qhull */
00761   int   ridgeoutnum;      /* number of ridges for 4OFF output (qh_printbegin,etc) */
00762 };
00763 
00764 /*=========== -macros- =========================*/
00765 
00766 /*-<a                             href="qh-poly.htm#TOC"
00767   >--------------------------------</a><a name="otherfacet_">-</a>
00768 
00769   otherfacet_(ridge, facet)
00770     return neighboring facet for a ridge in facet
00771 */
00772 #define otherfacet_(ridge, facet) \
00773                         (((ridge)->top == (facet)) ? (ridge)->bottom : (ridge)->top)
00774 
00775 /*-<a                             href="qh-poly.htm#TOC"
00776   >--------------------------------</a><a name="getid_">-</a>
00777 
00778   getid_(p)
00779     return int ID for facet, ridge, or vertex
00780     return -1 if NULL
00781 */
00782 #define getid_(p)       ((p) ? (int)((p)->id) : -1)
00783 
00784 /*============== FORALL macros ===================*/
00785 
00786 /*-<a                             href="qh-poly.htm#TOC"
00787   >--------------------------------</a><a name="FORALLfacets">-</a>
00788 
00789   FORALLfacets { ... }
00790     assign 'facet' to each facet in qh.facet_list
00791 
00792   notes:
00793     uses 'facetT *facet;'
00794     assumes last facet is a sentinel
00795 
00796   see:
00797     FORALLfacet_( facetlist )
00798 */
00799 #define FORALLfacets for (facet=qh facet_list;facet && facet->next;facet=facet->next)
00800 
00801 /*-<a                             href="qh-poly.htm#TOC"
00802   >--------------------------------</a><a name="FORALLpoints">-</a>
00803 
00804   FORALLpoints { ... }
00805     assign 'point' to each point in qh.first_point, qh.num_points
00806 
00807   declare:
00808     coordT *point, *pointtemp;
00809 */
00810 #define FORALLpoints FORALLpoint_(qh first_point, qh num_points)
00811 
00812 /*-<a                             href="qh-poly.htm#TOC"
00813   >--------------------------------</a><a name="FORALLpoint_">-</a>
00814 
00815   FORALLpoint_( points, num) { ... }
00816     assign 'point' to each point in points array of num points
00817 
00818   declare:
00819     coordT *point, *pointtemp;
00820 */
00821 #define FORALLpoint_(points, num) for (point= (points), \
00822       pointtemp= (points)+qh hull_dim*(num); point < pointtemp; point += qh hull_dim)
00823 
00824 /*-<a                             href="qh-poly.htm#TOC"
00825   >--------------------------------</a><a name="FORALLvertices">-</a>
00826 
00827   FORALLvertices { ... }
00828     assign 'vertex' to each vertex in qh.vertex_list
00829 
00830   declare:
00831     vertexT *vertex;
00832 
00833   notes:
00834     assumes qh.vertex_list terminated with a sentinel
00835 */
00836 #define FORALLvertices for (vertex=qh vertex_list;vertex && vertex->next;vertex= vertex->next)
00837 
00838 /*-<a                             href="qh-poly.htm#TOC"
00839   >--------------------------------</a><a name="FOREACHfacet_">-</a>
00840 
00841   FOREACHfacet_( facets ) { ... }
00842     assign 'facet' to each facet in facets
00843 
00844   declare:
00845     facetT *facet, **facetp;
00846 
00847   see:
00848     <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
00849 */
00850 #define FOREACHfacet_(facets)    FOREACHsetelement_(facetT, facets, facet)
00851 
00852 /*-<a                             href="qh-poly.htm#TOC"
00853   >--------------------------------</a><a name="FOREACHneighbor_">-</a>
00854 
00855   FOREACHneighbor_( facet ) { ... }
00856     assign 'neighbor' to each neighbor in facet->neighbors
00857 
00858   FOREACHneighbor_( vertex ) { ... }
00859     assign 'neighbor' to each neighbor in vertex->neighbors
00860 
00861   declare:
00862     facetT *neighbor, **neighborp;
00863 
00864   see:
00865     <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
00866 */
00867 #define FOREACHneighbor_(facet)  FOREACHsetelement_(facetT, facet->neighbors, neighbor)
00868 
00869 /*-<a                             href="qh-poly.htm#TOC"
00870   >--------------------------------</a><a name="FOREACHpoint_">-</a>
00871 
00872   FOREACHpoint_( points ) { ... }
00873     assign 'point' to each point in points set
00874 
00875   declare:
00876     pointT *point, **pointp;
00877 
00878   see:
00879     <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
00880 */
00881 #define FOREACHpoint_(points)    FOREACHsetelement_(pointT, points, point)
00882 
00883 /*-<a                             href="qh-poly.htm#TOC"
00884   >--------------------------------</a><a name="FOREACHridge_">-</a>
00885 
00886   FOREACHridge_( ridges ) { ... }
00887     assign 'ridge' to each ridge in ridges set
00888 
00889   declare:
00890     ridgeT *ridge, **ridgep;
00891 
00892   see:
00893     <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
00894 */
00895 #define FOREACHridge_(ridges)    FOREACHsetelement_(ridgeT, ridges, ridge)
00896 
00897 /*-<a                             href="qh-poly.htm#TOC"
00898   >--------------------------------</a><a name="FOREACHvertex_">-</a>
00899 
00900   FOREACHvertex_( vertices ) { ... }
00901     assign 'vertex' to each vertex in vertices set
00902 
00903   declare:
00904     vertexT *vertex, **vertexp;
00905 
00906   see:
00907     <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
00908 */
00909 #define FOREACHvertex_(vertices) FOREACHsetelement_(vertexT, vertices,vertex)
00910 
00911 /*-<a                             href="qh-poly.htm#TOC"
00912   >--------------------------------</a><a name="FOREACHfacet_i_">-</a>
00913 
00914   FOREACHfacet_i_( facets ) { ... }
00915     assign 'facet' and 'facet_i' for each facet in facets set
00916 
00917   declare:
00918     facetT *facet;
00919     int     facet_n, facet_i;
00920 
00921   see:
00922     <a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
00923 */
00924 #define FOREACHfacet_i_(facets)    FOREACHsetelement_i_(facetT, facets, facet)
00925 
00926 /*-<a                             href="qh-poly.htm#TOC"
00927   >--------------------------------</a><a name="FOREACHneighbor_i_">-</a>
00928 
00929   FOREACHneighbor_i_( facet ) { ... }
00930     assign 'neighbor' and 'neighbor_i' for each neighbor in facet->neighbors
00931 
00932   FOREACHneighbor_i_( vertex ) { ... }
00933     assign 'neighbor' and 'neighbor_i' for each neighbor in vertex->neighbors
00934 
00935   declare:
00936     facetT *neighbor;
00937     int     neighbor_n, neighbor_i;
00938 
00939   see:
00940     <a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
00941 */
00942 #define FOREACHneighbor_i_(facet)  FOREACHsetelement_i_(facetT, facet->neighbors, neighbor)
00943 
00944 /*-<a                             href="qh-poly.htm#TOC"
00945   >--------------------------------</a><a name="FOREACHpoint_i_">-</a>
00946 
00947   FOREACHpoint_i_( points ) { ... }
00948     assign 'point' and 'point_i' for each point in points set
00949 
00950   declare:
00951     pointT *point;
00952     int     point_n, point_i;
00953 
00954   see:
00955     <a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
00956 */
00957 #define FOREACHpoint_i_(points)    FOREACHsetelement_i_(pointT, points, point)
00958 
00959 /*-<a                             href="qh-poly.htm#TOC"
00960   >--------------------------------</a><a name="FOREACHridge_i_">-</a>
00961 
00962   FOREACHridge_i_( ridges ) { ... }
00963     assign 'ridge' and 'ridge_i' for each ridge in ridges set
00964 
00965   declare:
00966     ridgeT *ridge;
00967     int     ridge_n, ridge_i;
00968 
00969   see:
00970     <a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
00971 */
00972 #define FOREACHridge_i_(ridges)    FOREACHsetelement_i_(ridgeT, ridges, ridge)
00973 
00974 /*-<a                             href="qh-poly.htm#TOC"
00975   >--------------------------------</a><a name="FOREACHvertex_i_">-</a>
00976 
00977   FOREACHvertex_i_( vertices ) { ... }
00978     assign 'vertex' and 'vertex_i' for each vertex in vertices set
00979 
00980   declare:
00981     vertexT *vertex;
00982     int     vertex_n, vertex_i;
00983 
00984   see:
00985     <a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
00986 */
00987 #define FOREACHvertex_i_(vertices) FOREACHsetelement_i_(vertexT, vertices,vertex)
00988 
00989 /********* -libqhull.c prototypes (duplicated from qhull_a.h) **********************/
00990 
00991 void    qh_qhull(void);
00992 boolT   qh_addpoint(pointT *furthest, facetT *facet, boolT checkdist);
00993 void    qh_printsummary(FILE *fp);
00994 
00995 /********* -user.c prototypes (alphabetical) **********************/
00996 
00997 void    qh_errexit(int exitcode, facetT *facet, ridgeT *ridge);
00998 void    qh_errprint(const char* string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex);
00999 int     qh_new_qhull(int dim, int numpoints, coordT *points, boolT ismalloc,
01000                 char *qhull_cmd, FILE *outfile, FILE *errfile);
01001 void    qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall);
01002 void    qh_printhelp_degenerate(FILE *fp);
01003 void    qh_printhelp_narrowhull(FILE *fp, realT minangle);
01004 void    qh_printhelp_singular(FILE *fp);
01005 void    qh_user_memsizes(void);
01006 
01007 /********* -usermem.c prototypes (alphabetical) **********************/
01008 void    qh_exit(int exitcode);
01009 void    qh_free(void *mem);
01010 void   *qh_malloc(size_t size);
01011 
01012 /********* -userprintf.c and userprintf_rbox.c prototypes **********************/
01013 void    qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... );
01014 void    qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... );
01015 
01016 /***** -geom.c/geom2.c/random.c prototypes (duplicated from geom.h, random.h) ****************/
01017 
01018 facetT *qh_findbest(pointT *point, facetT *startfacet,
01019                      boolT bestoutside, boolT newfacets, boolT noupper,
01020                      realT *dist, boolT *isoutside, int *numpart);
01021 facetT *qh_findbestnew(pointT *point, facetT *startfacet,
01022                      realT *dist, boolT bestoutside, boolT *isoutside, int *numpart);
01023 boolT   qh_gram_schmidt(int dim, realT **rows);
01024 void    qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
01025 void    qh_printsummary(FILE *fp);
01026 void    qh_projectinput(void);
01027 void    qh_randommatrix(realT *buffer, int dim, realT **row);
01028 void    qh_rotateinput(realT **rows);
01029 void    qh_scaleinput(void);
01030 void    qh_setdelaunay(int dim, int count, pointT *points);
01031 coordT  *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible);
01032 
01033 /***** -global.c prototypes (alphabetical) ***********************/
01034 
01035 unsigned long qh_clock(void);
01036 void    qh_checkflags(char *command, char *hiddenflags);
01037 void    qh_clear_outputflags(void);
01038 void    qh_freebuffers(void);
01039 void    qh_freeqhull(boolT allmem);
01040 void    qh_freeqhull2(boolT allmem);
01041 void    qh_init_A(FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[]);
01042 void    qh_init_B(coordT *points, int numpoints, int dim, boolT ismalloc);
01043 void    qh_init_qhull_command(int argc, char *argv[]);
01044 void    qh_initbuffers(coordT *points, int numpoints, int dim, boolT ismalloc);
01045 void    qh_initflags(char *command);
01046 void    qh_initqhull_buffers(void);
01047 void    qh_initqhull_globals(coordT *points, int numpoints, int dim, boolT ismalloc);
01048 void    qh_initqhull_mem(void);
01049 void    qh_initqhull_outputflags(void);
01050 void    qh_initqhull_start(FILE *infile, FILE *outfile, FILE *errfile);
01051 void    qh_initqhull_start2(FILE *infile, FILE *outfile, FILE *errfile);
01052 void    qh_initthresholds(char *command);
01053 void    qh_option(const char *option, int *i, realT *r);
01054 #if qh_QHpointer
01055 void    qh_restore_qhull(qhT **oldqh);
01056 qhT    *qh_save_qhull(void);
01057 #endif
01058 
01059 /***** -io.c prototypes (duplicated from io.h) ***********************/
01060 
01061 void    dfacet( unsigned id);
01062 void    dvertex( unsigned id);
01063 void    qh_printneighborhood(FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall);
01064 void    qh_produce_output(void);
01065 coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc);
01066 
01067 
01068 /********* -mem.c prototypes (duplicated from mem.h) **********************/
01069 
01070 void qh_meminit(FILE *ferr);
01071 void qh_memfreeshort(int *curlong, int *totlong);
01072 
01073 /********* -poly.c/poly2.c prototypes (duplicated from poly.h) **********************/
01074 
01075 void    qh_check_output(void);
01076 void    qh_check_points(void);
01077 setT   *qh_facetvertices(facetT *facetlist, setT *facets, boolT allfacets);
01078 facetT *qh_findbestfacet(pointT *point, boolT bestoutside,
01079            realT *bestdist, boolT *isoutside);
01080 vertexT *qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp);
01081 pointT *qh_point(int id);
01082 setT   *qh_pointfacet(void /*qh.facet_list*/);
01083 int     qh_pointid(pointT *point);
01084 setT   *qh_pointvertex(void /*qh.facet_list*/);
01085 void    qh_setvoronoi_all(void);
01086 void    qh_triangulate(void /*qh facet_list*/);
01087 
01088 /********* -rboxpoints.c prototypes **********************/
01089 int     qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command);
01090 void    qh_errexit_rbox(int exitcode);
01091 
01092 /********* -stat.c prototypes (duplicated from stat.h) **********************/
01093 
01094 void    qh_collectstatistics(void);
01095 void    qh_printallstatistics(FILE *fp, const char *string);
01096 
01097 #endif /* qhDEFlibqhull */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libqhull
Author(s): Robert Krug
autogenerated on Tue Jun 18 2013 12:38:49