30 #define isatty _isatty 48 qhull- compute convex hulls and related structures.\n\ 49 http://www.qhull.org %s\n\ 52 first lines: dimension and number of points (or vice-versa).\n\ 53 other lines: point coordinates, best if one point per line\n\ 54 comments: start with a non-numeric character\n\ 55 halfspaces: use dim plus one and put offset after coefficients.\n\ 56 May be preceded by a single interior point ('H').\n\ 59 d - Delaunay triangulation by lifting points to a paraboloid\n\ 60 d Qu - furthest-site Delaunay triangulation (upper convex hull)\n\ 61 v - Voronoi diagram (dual of the Delaunay triangulation)\n\ 62 v Qu - furthest-site Voronoi diagram\n\ 63 Hn,n,... - halfspace intersection about point [n,n,0,...]\n\ 64 Qt - triangulated output\n\ 65 QJ - joggled input instead of merged facets\n\ 66 Qc - keep coplanar points with nearest facet\n\ 67 Qi - keep interior points with nearest facet\n\ 69 Qhull control options:\n\ 70 Qbk:n - scale coord k so that low bound is n\n\ 71 QBk:n - scale coord k so that upper bound is n (QBk is %2.2g)\n\ 72 QbB - scale input to unit cube centered at the origin\n\ 73 Qbb - scale last coordinate to [0,m] for Delaunay triangulations\n\ 74 Qbk:0Bk:0 - remove k-th coordinate from input\n\ 75 QJn - randomly joggle input in range [-n,n]\n\ 76 QRn - random rotation (n=seed, n=0 time, n=-1 time/no rotate)\n\ 79 Qf - partition point to furthest outside facet\n\ 80 Qg - only build good facets (needs 'QGn', 'QVn', or 'PdD')\n\ 81 Qm - only process points that would increase max_outside\n\ 82 Qr - process random outside points instead of furthest ones\n\ 83 Qs - search all points for the initial simplex\n\ 84 Qu - for 'd' or 'v', compute upper hull without point at-infinity\n\ 85 returns furthest-site Delaunay triangulation\n\ 86 Qv - test vertex neighbors for convexity\n\ 87 Qx - exact pre-merges (skips coplanar and angle-coplanar facets)\n\ 88 Qz - add point-at-infinity to Delaunay triangulation\n\ 89 QGn - good facet if visible from point n, -n for not visible\n\ 90 QVn - good facet if it includes point n, -n if not\n\ 91 Q0 - turn off default premerge with 'C-0'/'Qx'\n\ 92 Q1 - sort merges by type instead of angle\n\ 93 Q2 - merge all non-convex at once instead of independent sets\n\ 94 Q3 - do not merge redundant vertices\n\ 95 Q4 - avoid old->new merges\n\ 96 Q5 - do not correct outer planes at end of qhull\n\ 97 Q6 - do not pre-merge concave or coplanar facets\n\ 98 Q7 - depth-first processing instead of breadth-first\n\ 99 Q8 - do not process near-inside points\n\ 100 Q9 - process furthest of furthest points\n\ 101 Q10 - no special processing for narrow distributions\n\ 102 Q11 - copy normals and recompute centrums for tricoplanar facets\n\ 103 Q12 - no error on wide merge due to duplicate ridge\n\ 107 Topts- Trace options:\n\ 108 T4 - trace at level n, 4=all, 5=mem/gauss, -1= events\n\ 109 Ta - annotate output with message codes\n\ 110 Tc - check frequently during execution\n\ 111 Ts - print statistics\n\ 112 Tv - verify result: structure, convexity, and point inclusion\n\ 113 Tz - send all output to stdout\n\ 114 TFn - report summary when n or more facets created\n\ 115 TI file - input data from file, no spaces or single quotes\n\ 116 TO file - output results to file, may be enclosed in single quotes\n\ 117 TPn - turn on tracing when point n added to hull\n\ 118 TMn - turn on tracing at merge n\n\ 119 TWn - trace merge facets when width > n\n\ 120 TRn - rerun qhull n times. Use with 'QJn'\n\ 121 TVn - stop qhull after adding point n, -n for before (see TCn)\n\ 122 TCn - stop qhull after building cone for point n (see TVn)\n\ 124 Precision options:\n\ 125 Cn - radius of centrum (roundoff added). Merge facets if non-convex\n\ 126 An - cosine of maximum angle. Merge facets if cosine > n or non-convex\n\ 127 C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge\n\ 128 En - max roundoff error for distance computation\n\ 129 Rn - randomly perturb computations by a factor of [1-n,1+n]\n\ 130 Vn - min distance above plane for a visible facet (default 3C-n or En)\n\ 131 Un - max distance below plane for a new, coplanar point (default Vn)\n\ 132 Wn - min facet width for outside point (before roundoff, default 2Vn)\n\ 134 Output formats (may be combined; if none, produces a summary to stdout):\n\ 136 G - Geomview output (see below)\n\ 137 i - vertices incident to each facet\n\ 138 m - Mathematica output (2-d and 3-d)\n\ 139 o - OFF format (dim, points and facets; Voronoi regions)\n\ 140 n - normals with offsets\n\ 141 p - vertex coordinates or Voronoi vertices (coplanar points if 'Qc')\n\ 142 s - summary (stderr)\n\ 147 Fa - area for each facet\n\ 148 FA - compute total area and volume for option 's'\n\ 149 Fc - count plus coplanar points for each facet\n\ 150 use 'Qc' (default) for coplanar and 'Qi' for interior\n\ 151 FC - centrum or Voronoi center for each facet\n\ 152 Fd - use cdd format for input (homogeneous with offset first)\n\ 153 FD - use cdd format for numeric output (offset first)\n\ 154 FF - facet dump without ridges\n\ 155 Fi - inner plane for each facet\n\ 156 for 'v', separating hyperplanes for bounded Voronoi regions\n\ 157 FI - ID of each facet\n\ 158 Fm - merge count for each facet (511 max)\n\ 159 FM - Maple output (2-d and 3-d)\n\ 160 Fn - count plus neighboring facets for each facet\n\ 161 FN - count plus neighboring facets for each point\n\ 162 Fo - outer plane (or max_outside) for each facet\n\ 163 for 'v', separating hyperplanes for unbounded Voronoi regions\n\ 164 FO - options and precision constants\n\ 165 Fp - dim, count, and intersection coordinates (halfspace only)\n\ 166 FP - nearest vertex and distance for each coplanar point\n\ 167 FQ - command used for qhull\n\ 168 Fs - summary: #int (8), dimension, #points, tot vertices, tot facets,\n\ 169 output: #vertices, #facets, #coplanars, #nonsimplicial\n\ 170 #real (2), max outer plane, min vertex\n\ 171 FS - sizes: #int (0)\n\ 172 #real (2) tot area, tot volume\n\ 173 Ft - triangulation with centrums for non-simplicial facets (OFF format)\n\ 174 Fv - count plus vertices for each facet\n\ 175 for 'v', Voronoi diagram as Voronoi vertices for pairs of sites\n\ 176 FV - average of vertices (a feasible point for 'H')\n\ 177 Fx - extreme points (in order for 2-d)\n\ 181 Geomview options (2-d, 3-d, and 4-d; 2-d Voronoi)\n\ 182 Ga - all points as dots\n\ 183 Gp - coplanar points and vertices as radii\n\ 184 Gv - vertices as spheres\n\ 185 Gi - inner planes only\n\ 187 Go - outer planes only\n\ 189 Gh - hyperplane intersections\n\ 191 GDn - drop dimension n in 3-d and 4-d output\n\ 192 Gt - for 3-d 'd', transparent outer ridges\n\ 195 PAn - keep n largest facets by area\n\ 196 Pdk:n - drop facet if normal[k] <= n (default 0.0)\n\ 197 PDk:n - drop facet if normal[k] >= n\n\ 198 Pg - print good facets (needs 'QGn' or 'QVn')\n\ 199 PFn - keep facets whose area is at least n\n\ 200 PG - print neighbors of good facets\n\ 201 PMn - keep n facets with most merges\n\ 202 Po - force output. If error, output neighborhood of facet\n\ 203 Pp - do not report precision problems\n\ 205 . - list of all options\n\ 206 - - one line descriptions of all options\n\ 218 qhull- compute convex hulls and related structures. Qhull %s\n\ 219 input (stdin): dimension, n, point coordinates\n\ 220 comments start with a non-numeric character\n\ 221 halfspace: use dim+1 and put offsets after coefficients\n\ 223 options (qh-quick.htm):\n\ 224 d - Delaunay triangulation by lifting points to a paraboloid\n\ 225 d Qu - furthest-site Delaunay triangulation (upper convex hull)\n\ 226 v - Voronoi diagram as the dual of the Delaunay triangulation\n\ 227 v Qu - furthest-site Voronoi diagram\n\ 228 H1,1 - Halfspace intersection about [1,1,0,...] via polar duality\n\ 229 Qt - triangulated output\n\ 230 QJ - joggled input instead of merged facets\n\ 231 Tv - verify result: structure, convexity, and point inclusion\n\ 232 . - concise list of all options\n\ 233 - - one-line description of each option\n\ 236 Output options (subset):\n\ 237 s - summary of results (default)\n\ 238 i - vertices incident to each facet\n\ 239 n - normals with offsets\n\ 240 p - vertex coordinates (if 'Qc', includes coplanar points)\n\ 241 if 'v', Voronoi vertices\n\ 242 Fp - halfspace intersections\n\ 243 Fx - extreme points (convex hull vertices)\n\ 244 FA - compute total area and volume\n\ 245 o - OFF format (if 'v', outputs Voronoi regions)\n\ 246 G - Geomview output (2-d, 3-d and 4-d)\n\ 247 m - Mathematica output (2-d and 3-d)\n\ 248 QVn - print facets that include point n, -n if not\n\ 249 TO file- output results to file, may be enclosed in single quotes\n\ 252 rbox D4 | qhull Tv rbox 1000 s | qhull Tv s FA\n\ 253 rbox 10 D2 | qhull d QJ s i TO result rbox 10 D2 | qhull v Qbb Qt p\n\ 254 rbox 10 D2 | qhull d Qu QJ m rbox 10 D2 | qhull v Qu QJ o\n\ 255 rbox c d D2 | qhull Qc s f Fx | more rbox c | qhull FV n | qhull H Fp\n\ 256 rbox d D12 | qhull QR0 FA rbox c D7 | qhull FA TF1000\n\ 257 rbox y 1000 W0 | qhull rbox c | qhull n\n\ 270 Except for 'F.' and 'PG', upper-case options take an argument.\n\ 272 delaunay voronoi Geomview Halfspace facet_dump\n\ 273 incidences mathematica normals OFF_format points\n\ 276 Farea FArea-total Fcoplanars FCentrums Fd-cdd-in\n\ 277 FD-cdd-out FF-dump-xridge Finner FIDs Fmerges\n\ 278 Fneighbors FNeigh-vertex Fouter FOptions Fpoint-intersect\n\ 279 FPoint_near FQhull Fsummary FSize Ftriangles\n\ 280 Fvertices Fvoronoi FVertex-ave Fxtremes FMaple\n\ 282 Gvertices Gpoints Gall_points Gno_planes Ginner\n\ 283 Gcentrums Ghyperplanes Gridges Gouter GDrop_dim\n\ 286 PArea-keep Pdrop d0:0D0 Pgood PFacet_area_keep\n\ 287 PGood_neighbors PMerge-keep Poutput_forced Pprecision_not\n\ 289 QbBound 0:0.5 Qbk:0Bk:0_drop QbB-scale-box Qbb-scale-last Qcoplanar\n\ 290 Qfurthest Qgood_only QGood_point Qinterior Qmax_out\n\ 291 QJoggle Qrandom QRotate Qsearch_1st Qtriangulate\n\ 292 QupperDelaunay QVertex_good Qvneighbors Qxact_merge Qzinfinite\n\ 294 Q0_no_premerge Q1_no_angle Q2_no_independ Q3_no_redundant Q4_no_old\n\ 295 Q5_no_check_out Q6_no_concave Q7_depth_first Q8_no_near_in Q9_pick_furthest\n\ 296 Q10_no_narrow Q11_trinormals Q12_no_wide_dup\n\ 298 T4_trace Tannotate Tcheck_often Tstatistics Tverify\n\ 299 Tz_stdout TFacet_log TInput_file TPoint_trace TMerge_trace\n\ 300 TOutput_file TRerun TWide_trace TVertex_stop TCone_stop\n\ 302 Angle_max Centrum_size Error_round Random_dist Visible_min\n\ 303 Ucoplanar_max Wide_outside\n\ 321 int main(
int argc,
char *argv[]) {
322 int curlong, totlong;
323 int exitcode, numpoints,
dim;
331 if ((argc == 1) &&
isatty( 0 )) {
335 if (argc > 1 && *argv[1] ==
'-' && !*(argv[1]+1)) {
340 if (argc > 1 && *argv[1] ==
'.' && !*(argv[1]+1)) {
344 if (argc > 1 && *argv[1] ==
'-' && *(argv[1]+1)==
'V') {
348 qh_init_A(qh, stdin, stdout, stderr, argc, argv);
354 qh_init_B(qh, points, numpoints, dim, ismalloc);
368 if (curlong || totlong)
369 qh_fprintf_stderr(6263,
"qhull internal warning (main): did not free %d bytes of long memory(%d pieces)\n",
int main(int argc, char *argv[])
void qh_fprintf_stderr(int msgcode, const char *fmt,...)
void qh_check_output(void)
void qh_init_A(FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[])
void qh_check_points(void)
void qh_produce_output(void)
void qh_freeqhull(boolT allmem)
void qh_init_B(coordT *points, int numpoints, int dim, boolT ismalloc)
void qh_memfreeshort(int *curlong, int *totlong)
coordT * qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc)
void qh_initflags(char *command)