74 trace2((qh, qh->
ferr, 2055,
"qh_qhull: all facets are clearly convex and no coplanar points. Post-merging and check of maxout not needed.\n"));
97 qh_fprintf(qh, qh->
ferr, 8115,
"\nTesting all coplanar points.\n");
105 qh_fprintf(qh, qh->
ferr, 6164,
"qhull internal error (qh_qhull): temporary sets not empty(%d)\n",
111 trace1((qh, qh->
ferr, 1036,
"Qhull: algorithm completed\n"));
169 int goodvisible, goodhorizon;
172 realT dist, newbalance, pbalance;
174 int numpart, numpoints, numnew, firstnew;
180 qh_fprintf(qh, qh->
ferr, 6213,
"qhull internal error (qh_addpoint): NULL facet. Need to call qh_findbestfacet first\n");
185 &dist, &isoutside, &numpart);
276 trace2((qh, qh->
ferr, 2056,
"qh_addpoint: added p%d new facets %d new balance %2.2g point balance %2.2g\n",
277 qh_pointid(qh, furthest), numnew, newbalance, pbalance));
304 qh_fprintf(qh, qh->
ferr, 6229,
"qhull precision error: %d attempts to construct a convex hull\n\ 305 with joggled input. Increase joggle above 'QJ%2.2g'\n\ 306 or modify qh_JOGGLE... parameters in user.h\n",
370 trace1((qh, qh->
ferr, 1037,
"qh_buildhull: start build hull\n"));
373 qh_fprintf(qh, qh->
ferr, 6165,
"qhull internal error (qh_buildhull): visible or new facet f%d in facet list\n",
380 qh_fprintf(qh, qh->
ferr, 6166,
"qhull internal error (qh_buildhull): new vertex f%d in vertex list\n",
382 qh_errprint(qh,
"ERRONEOUS", NULL, NULL, NULL, vertex);
389 trace1((qh, qh->
ferr, 1038,
"qh_buildhull: stop point or cone P%d in initial hull\n",
id));
402 qh_fprintf(qh, qh->
ferr, 6167,
"qhull internal error (qh_buildhull): %d outside points were never processed.\n", qh->
num_outside);
405 trace1((qh, qh->
ferr, 1039,
"qh_buildhull: completed the hull construction\n"));
438 int total, furthestid;
447 tp= localtime(&timedata);
452 At %02d:%02d:%02d & %2.5g CPU secs, qhull has created %d facets and merged %d.\n\ 453 The current hull contains %d facets and %d vertices. Last point was p%d\n",
454 tp->tm_hour, tp->tm_min, tp->tm_sec, cpu, qh->
facet_id -1,
469 tp= localtime(&timedata);
476 At %02d:%02d:%02d & %2.5g CPU secs, qhull has created %d facets and merged %d.\n\ 477 The current hull contains %d facets and %d vertices. There are %d\n\ 478 outside points. Next is point p%d(v%d), %2.2g above f%d.\n",
479 tp->tm_hour, tp->tm_min, tp->tm_sec, cpu, qh->
facet_id -1,
486 qh_fprintf(qh, qh->
ferr, 8120,
"qh_addpoint: add p%d(v%d) to hull of %d facets(%2.2g above f%d) and %d outside at %4.4g CPU secs. Previous was p%d.\n",
491 if (qh->
visit_id > (
unsigned) INT_MAX) {
523 qh_errprint(qh,
"ERRONEOUS", facet, otherfacet, NULL, NULL);
557 facetT *neighbor, **neighborp, *visible;
558 int numhorizon= 0, coplanar= 0;
561 trace1((qh, qh->
ferr, 1040,
"qh_findhorizon: find horizon for point p%d facet f%d\n",
qh_pointid(qh, point),facet->
id));
562 *goodvisible= *goodhorizon= 0;
573 qh_errprint(qh,
"visible", facet, NULL, NULL, NULL);
577 qh_fprintf(qh, qh->
ferr, 6230,
"Qhull internal error (qh_findhorizon): does not work for tricoplanar facets. Use option 'Q11'\n");
597 qh_errprint(qh,
"visible", neighbor, NULL, NULL, NULL);
614 trace2((qh, qh->
ferr, 2057,
"qh_findhorizon: point p%d is coplanar to horizon f%d, dist=%2.7g < qh->MINvisible(%2.7g)\n",
623 qh_errprint(qh,
"horizon", neighbor, NULL, NULL, NULL);
629 qh_fprintf(qh, qh->
ferr, 6168,
"qhull precision error (qh_findhorizon): empty horizon\n\ 630 QhullPoint p%d was above all facets.\n",
qh_pointid(qh, point));
634 trace1((qh, qh->
ferr, 1041,
"qh_findhorizon: %d horizon facets(good %d), %d visible(good %d), %d coplanar\n",
635 numhorizon, *goodhorizon, qh->
num_visible, *goodvisible, coplanar));
683 #if qh_COMPUTEfurthest 689 if (dist < qh->MINoutside) {
714 idx= (int)floor((qh->
num_outside - outcoplanar) * randr);
720 else if (size > idx) {
727 qh_fprintf(qh, qh->
ferr, 6169,
"qhull internal error (qh_nextfurthest): num_outside %d is too low\nby at least %d, or a random real %g >= 1.0\n",
780 pointT *point, **pointp, *bestpoint;
781 int size, point_i, point_n, point_end, remaining, i, id;
785 trace1((qh, qh->
ferr, 1042,
"qh_partitionall: partition all points into outside sets\n"));
789 for (i=numpoints, point= points; i--; point += qh->
hull_dim)
807 point_end= numpoints;
809 size= point_end/(remaining--) + 100;
817 if (dist < distoutside)
818 SETelem_(pointset, point_end++)= point;
824 }
else if (dist > bestdist) {
835 #if !qh_COMPUTEfurthest 899 realT bestdist, dist2= 0, angle;
900 int numpart= 0, oldfindbest;
909 &bestdist, &isoutside, &numpart);
914 if (bestdist < -qh->NEARinside) {
916 trace4((qh, qh->
ferr, 4062,
"qh_partitioncoplanar: point p%d is more than near-inside facet f%d dist %2.2g findbestnew %d\n",
920 }
else if (bestdist < -qh->MAXcoplanar) {
921 trace4((qh, qh->
ferr, 4063,
"qh_partitioncoplanar: point p%d is inside facet f%d dist %2.2g findbestnew %d\n",
932 if (!dist && facet != bestfacet) {
939 trace2((qh, qh->
ferr, 2058,
"qh_partitioncoplanar: repartition point p%d from f%d. It is above flipped facet f%d dist %2.2g\n",
950 qh_fprintf(qh, qh->
ferr, 8122,
"qh_partitioncoplanar: ====== p%d from f%d increases max_outside to %2.2g of f%d last p%d\n",
952 qh_errprint(qh,
"DISTANT", facet, bestfacet, NULL, NULL);
961 if (!oldfurthest || dist2 < bestdist)
966 trace4((qh, qh->
ferr, 4064,
"qh_partitioncoplanar: point p%d is coplanar with facet f%d(or inside) dist %2.2g\n",
1010 #if qh_COMPUTEfurthest 1018 &bestdist, &isoutside, &numpart);
1023 qh_precision(qh,
"nearly incident point(narrow hull)");
1039 #if !qh_COMPUTEfurthest 1043 #if qh_COMPUTEfurthest 1046 if (dist < bestdist)
1059 trace4((qh, qh->
ferr, 4065,
"qh_partitionpoint: point p%d is outside facet f%d new? %d (or narrowhull)\n",
1068 trace4((qh, qh->
ferr, 4066,
"qh_partitionpoint: point p%d is coplanar to facet f%d (dropped)\n",
1076 trace4((qh, qh->
ferr, 4067,
"qh_partitionpoint: point p%d is inside all facets, closest to f%d dist %2.2g\n",
1118 facetT *visible, *newfacet;
1120 int coplanar=0, size;
1132 while (newfacet && newfacet->
visible) {
1140 qh_fprintf(qh, qh->
ferr, 6170,
"qhull precision error (qh_partitionvisible): all new facets deleted as\n degenerate facets. Can not continue.\n");
1145 *numoutside += size;
1162 if (vertex->
point) {
1169 trace1((qh, qh->
ferr, 1043,
"qh_partitionvisible: partitioned %d points from outsidesets and %d points from coplanarsets\n", *numoutside, coplanar));
1184 trace0((qh, qh->
ferr, 26,
"qh_precision: qhull restart because of %s\n", reason));
1206 realT ratio, outerplane, innerplane;
1208 int size, id, nummerged, numvertices, numcoplanars= 0, nonsimplicial=0;
1213 int numtricoplanars= 0;
1232 qh_fprintf(qh, fp, 9288,
"\nAt a premature exit due to 'TVn', 'TCn', 'TRn', or precision error with 'QJn'.");
1243 Furthest-site Voronoi vertices by the convex hull of %d points in %d-d:\n\n", size, qh->
hull_dim);
1246 Voronoi diagram by the convex hull of %d points in %d-d:\n\n", size, qh->
hull_dim);
1247 qh_fprintf(qh, fp, 9291,
" Number of Voronoi regions%s: %d\n",
1248 qh->
ATinfinity ?
" and at-infinity" :
"", numvertices);
1250 qh_fprintf(qh, fp, 9292,
" Total number of deleted points due to merging: %d\n", numdel);
1251 if (numcoplanars - numdel > 0)
1252 qh_fprintf(qh, fp, 9293,
" Number of nearly incident points: %d\n", numcoplanars - numdel);
1253 else if (size - numvertices - numdel > 0)
1254 qh_fprintf(qh, fp, 9294,
" Total number of nearly incident points: %d\n", size - numvertices - numdel);
1255 qh_fprintf(qh, fp, 9295,
" Number of%s Voronoi vertices: %d\n",
1256 goodused ?
" 'good'" :
"", qh->
num_good);
1258 qh_fprintf(qh, fp, 9296,
" Number of%s non-simplicial Voronoi vertices: %d\n",
1259 goodused ?
" 'good'" :
"", nonsimplicial);
1263 Furthest-site Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh->
hull_dim);
1266 Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh->
hull_dim);
1267 qh_fprintf(qh, fp, 9299,
" Number of input sites%s: %d\n",
1268 qh->
ATinfinity ?
" and at-infinity" :
"", numvertices);
1270 qh_fprintf(qh, fp, 9300,
" Total number of deleted points due to merging: %d\n", numdel);
1271 if (numcoplanars - numdel > 0)
1272 qh_fprintf(qh, fp, 9301,
" Number of nearly incident points: %d\n", numcoplanars - numdel);
1273 else if (size - numvertices - numdel > 0)
1274 qh_fprintf(qh, fp, 9302,
" Total number of nearly incident points: %d\n", size - numvertices - numdel);
1275 qh_fprintf(qh, fp, 9303,
" Number of%s Delaunay regions: %d\n",
1276 goodused ?
" 'good'" :
"", qh->
num_good);
1278 qh_fprintf(qh, fp, 9304,
" Number of%s non-simplicial Delaunay regions: %d\n",
1279 goodused ?
" 'good'" :
"", nonsimplicial);
1282 Halfspace intersection by the convex hull of %d points in %d-d:\n\n", size, qh->
hull_dim);
1283 qh_fprintf(qh, fp, 9306,
" Number of halfspaces: %d\n", size);
1284 qh_fprintf(qh, fp, 9307,
" Number of non-redundant halfspaces: %d\n", numvertices);
1287 s=
"similar and redundant";
1292 qh_fprintf(qh, fp, 9308,
" Number of %s halfspaces: %d\n", s, numcoplanars);
1296 qh_fprintf(qh, fp, 9310,
" Number of 'good' intersection points: %d\n", qh->
num_good);
1298 qh_fprintf(qh, fp, 9311,
" Number of%s non-simplicial intersection points: %d\n",
1299 goodused ?
" 'good'" :
"", nonsimplicial);
1302 Convex hull of %d points in %d-d:\n\n", size, qh->
hull_dim);
1303 qh_fprintf(qh, fp, 9313,
" Number of vertices: %d\n", numvertices);
1306 s=
"coplanar and interior";
1311 qh_fprintf(qh, fp, 9314,
" Number of %s points: %d\n", s, numcoplanars);
1317 qh_fprintf(qh, fp, 9317,
" Number of%s non-simplicial facets: %d\n",
1318 goodused ?
" 'good'" :
"", nonsimplicial);
1320 if (numtricoplanars)
1321 qh_fprintf(qh, fp, 9318,
" Number of triangulated facets: %d\n", numtricoplanars);
1322 qh_fprintf(qh, fp, 9319,
"\nStatistics for: %s | %s",
1336 qh_fprintf(qh, fp, 9326,
" average new facet balance: %2.2g\n",
1340 qh_fprintf(qh, fp, 9327,
" new facet standard deviation: %2.2g\n", stddev);
1341 qh_fprintf(qh, fp, 9328,
" average partition balance: %2.2g\n",
1345 qh_fprintf(qh, fp, 9329,
" partition standard deviation: %2.2g\n", stddev);
1353 qh_fprintf(qh, fp, 9332,
" Number of merged facets: %d\n", nummerged);
1359 qh_fprintf(qh, fp, 9333,
" CPU seconds to compute hull (after input): %2.4g\n", cpu);
1363 qh_fprintf(qh, fp, 9334,
" Percentage of runs with precision errors: %4.1f\n",
1367 qh_fprintf(qh, fp, 9335,
" After %d retries, input joggled by: %2.2g\n",
1373 qh_fprintf(qh, fp, 9337,
" %s facet area: %2.8g\n",
1376 qh_fprintf(qh, fp, 9338,
" %s volume: %2.8g\n",
1381 qh_fprintf(qh, fp, 9339,
" Maximum distance of %spoint above facet: %2.2g",
1386 qh_fprintf(qh, fp, 9340,
" (%.1fx)\n", ratio);
1390 if (innerplane < -2 * qh->DISTround) {
1391 qh_fprintf(qh, fp, 9342,
" Maximum distance of %svertex below facet: %2.2g",
1395 qh_fprintf(qh, fp, 9343,
" (%.1fx)\n", ratio);
void qh_resetlists(boolT stats, boolT resetVisible)
void qh_deletevisible(void)
void qh_settruncate(setT *set, int size)
#define FOREACHvertex_(vertices)
void qh_removefacet(facetT *facet)
void qh_partitionall(qhT *qh, setT *vertices, pointT *points, int numpoints)
void qh_setappend2ndlast(setT **setp, void *newelem)
void qh_build_withrestart(qhT *qh)
void qh_joggleinput(void)
facetT * qh_findbestnew(pointT *point, facetT *startfacet, realT *dist, boolT bestoutside, boolT *isoutside, int *numpart)
void qh_fprintf(FILE *fp, int msgcode, const char *fmt,...)
void qh_partitioncoplanar(qhT *qh, pointT *point, facetT *facet, realT *dist)
void qh_partitionpoint(qhT *qh, pointT *point, facetT *facet)
void qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall)
#define FORALLfacet_(facetlist)
void qh_delvertex(vertexT *vertex)
int qh_pointid(pointT *point)
void qh_errexit2(qhT *qh, int exitcode, facetT *facet, facetT *otherfacet)
void qh_outcoplanar(void)
void qh_nearcoplanar(void)
void qh_appendfacet(facetT *facet)
void qh_attachnewfacets(void)
void qh_premerge(vertexT *apex, realT maxcentrum, realT maxangle)
void qh_buildhull(qhT *qh)
void qh_delfacet(facetT *facet)
realT qh_getangle(pointT *vect1, pointT *vect2)
void qh_infiniteloop(facetT *facet)
facetT * qh_findbest(pointT *point, facetT *startfacet, boolT bestoutside, boolT isnewfacets, boolT noupper, realT *dist, boolT *isoutside, int *numpart)
void qh_findhorizon(qhT *qh, pointT *point, facetT *facet, int *goodvisible, int *goodhorizon)
#define qh_USEfindbestnew
void * qh_setlast(setT *set)
void qh_settempfree(setT **set)
boolT qh_addpoint(qhT *qh, pointT *furthest, facetT *facet, boolT checkdist)
#define qh_JOGGLEmaxretry
int qh_findgood(facetT *facetlist, int goodhorizon)
pointT * qh_nextfurthest(qhT *qh, facetT **visible)
#define maximize_(maxval, val)
void qh_option(const char *option, int *i, realT *r)
realT qh_stddev(int num, realT tot, realT tot2, realT *ave)
void * qh_setdelnth(setT *set, int nth)
#define SETreturnsize_(set, size)
void qh_setfree(setT **setp)
vertexT * qh_makenewfacets(pointT *point)
void qh_partitionvisible(qhT *qh, boolT allpoints, int *numoutside)
#define FOREACHneighbor_(facet)
void qh_furthestnext(void)
void qh_printsummary(qhT *qh, FILE *fp)
void qh_setappend(setT **setp, void *newelem)
void qh_makenewplanes(void)
void * qh_setdellast(setT *set)
void qh_freebuild(boolT allmem)
void qh_furthestout(facetT *facet)
void qh_prependfacet(facetT *facet, facetT **facetlist)
unsigned int vertex_visit
void qh_checkpolygon(facetT *facetlist)
void qh_buildtracing(qhT *qh, pointT *furthest, facetT *facet)
void qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane)
#define qh_ALGORITHMfault
void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge)
void qh_matchnewfacets(void)
void qh_checkconvex(facetT *facetlist, int fault)
setT * qh_settemp(int setsize)
void qh_check_maxout(void)
void qh_precision(qhT *qh, const char *reason)
#define qh_DIMreduceBuild
#define FORALLvisible_facets
void qh_updatevertices(void)
void qh_distplane(pointT *point, facetT *facet, realT *dist)
int qh_setsize(setT *set)
setT * qh_setnew(int setsize)
void qh_errprint(const char *string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex)
#define SETaddr_(set, type)
#define FOREACHpoint_(points)
void qh_postmerge(const char *reason, realT maxcentrum, realT maxangle, boolT vneighbors)
#define FOREACHpoint_i_(points)
#define minimize_(minval, val)
boolT qh_checkzero(boolT testall)