FOREACHfacet_i_(qh, facets) { /* for each point with facet assignment */
if (facet)
unassigned= False;
else {
unassigned= True;
facet= qh->facet_list;
}
point= qh_point(qh, facet_i);
if (point == qh->GOODpointp)
continue;
qh_distplane(qh, point, facet, &dist);
numpart++;
bestfacet= qh_findbesthorizon(qh, !qh_IScheckmax, point, facet, qh_NOupper, &dist, &numpart);
/* occurs after statistics reported */
maximize_(maxdist, dist);
if (dist > maxoutside) {
if (qh->ONLYgood && !bestfacet->good
&& !((bestfacet= qh_findgooddist(qh, point, bestfacet, &dist, &facetlist))
&& dist > maxoutside))
notgood++;
else {
waserror= True;
qh_fprintf(qh, qh->ferr, 6109, "qhull precision error: point p%d is outside facet f%d, distance= %6.8g maxoutside= %6.8g\n",
facet_i, bestfacet->id, dist, maxoutside);
if (errfacet1 != bestfacet) {
errfacet2= errfacet1;
errfacet1= bestfacet;
}
}
}else if (unassigned && dist < -qh->MAXcoplanar)
notverified++;
}
qh_settempfree(qh, &facets);
if (notverified && !qh->DELAUNAY && !qh_QUICKhelp && qh->PRINTprecision)
qh_fprintf(qh, qh->ferr, 8092, "\n%d points were well inside the hull. If the hull contains\n\
a lens-shaped component, these points were not verified. Use\n\
options 'Qci Tv' to verify all points.\n", notverified);
if (maxdist > qh->outside_err) {
qh_fprintf(qh, qh->ferr, 6110, "qhull precision error (qh_check_bestdist): a coplanar point is %6.2g from convex hull. The maximum value(qh.outside_err) is %6.2g\n",
qh_fprintf(qh, qh->ferr, 7061, "qhull warning (qh_check_points): missing normal for facet f%d\n", facet->id);
continue;
}
if (testouter) {
#if qh_MAXoutside
maxoutside= facet->maxoutside + 2* qh->DISTround;
/* one DISTround to actual point and another to computed point */
#endif
}
FORALLpoints {
if (point != qh->GOODpointp)
qh_check_point(qh, point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2);
}
FOREACHpoint_(qh->other_points) {
if (point != qh->GOODpointp)
qh_check_point(qh, point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2);
}
}
if (maxdist > qh->outside_err) {
qh_fprintf(qh, qh->ferr, 6112, "qhull precision error (qh_check_points): a coplanar point is %6.2g from convex hull. The maximum value(qh.outside_err) is %6.2g\n",
qh_fprintf(qh, qh->ferr, 6122, "qhull internal error (qh_checkfacet): vertices of f%d are not in descending id order at v%d\n", facet->id, vertex->id);
if (qh_pointid(qh, vertex->point) == qh_IDunknown) {
qh_fprintf(qh, qh->ferr, 6139, "qhull internal error (qh_checkpolygon): unknown point %p for vertex v%d first_point %p\n",
vertex->point, vertex->id, qh->first_point);
waserror= True;
}
}
}
}
qh->vertex_visit += (unsigned int)numfacets;
if (facetlist == qh->facet_list) {
if (numfacets != qh->num_facets - qh->num_visible) {
qh_fprintf(qh, qh->ferr, 6140, "qhull internal error (qh_checkpolygon): actual number of facets is %d, cumulative facet count is %d - %d visible facets\n",
numfacets, qh->num_facets, qh->num_visible);
waserror= True;
}
qh->vertex_visit++;
if (qh->VERTEXneighbors) {
FORALLvertices {
qh_setcheck(qh, vertex->neighbors, "neighbors for v", vertex->id);
qh_fprintf(qh, qh->ferr, 6151, "qhull input error: 'Qg QVn' (only good vertex) does not work with merging.\nUse 'QJ' to joggle the input or 'Q0' to turn off merging.\n");
if (!qh_checkflipped(qh, facet, NULL, qh_ALL)) {/* due to axis-parallel facet */
trace1((qh, qh->ferr, 1031, "qh_initialhull: initial orientation incorrect. Correct all facets\n"));
facet->flipped= False;
FORALLfacets {
facet->toporient ^= (unsigned char)True;
qh_orientoutside(qh, facet);
}
break;
}
}
FORALLfacets {
if (!qh_checkflipped(qh, facet, NULL, !qh_ALL)) { /* can happen with 'R0.1' */
if (qh->DELAUNAY && ! qh->ATinfinity) {
if (qh->UPPERdelaunay)
qh_fprintf(qh, qh->ferr, 6240, "Qhull input error: Can not compute the upper Delaunay triangulation or upper Voronoi diagram of cocircular/cospherical points.\n");
else
qh_fprintf(qh, qh->ferr, 6239, "Qhull input error: Use option 'Qz' for the Delaunay triangulation or Voronoi diagram of cocircular/cospherical points. Option 'Qz' adds a point \"at infinity\" (above the corresponding paraboloid).\n");
qh_errexit(qh, qh_ERRinput, NULL, NULL);
}
qh_precision(qh, "initial facet is coplanar with interior point");
qh_fprintf(qh, qh->ferr, 6154, "qhull precision error: initial facet %d is coplanar with the interior point\n",
returns size of qh.hash_table of at least newsize slots
notes:
assumes qh.hash_table is NULL
qh_HASHfactor determines the number of extra slots
size is not divisible by 2, 3, or 5
*/
int qh_newhashtable(qhT *qh, int newsize) {
int size;
size= ((newsize+1)*qh_HASHfactor) | 0x1; /* odd number */
while (True) {
if (newsize<0 || size<0) {
qh_fprintf(qh, qh->qhmem.ferr, 6236, "qhull error (qh_newhashtable): negative request (%d) or size (%d). Did int overflow due to high-D?\n", newsize, size); /* WARN64 */
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
if ((size%3) && (size%5))
break;
size += 2;
/* loop terminates because there is an infinite number of primes */