45 qh_fprintf(qh, qh->
ferr, 6206,
"qhull internal error (qh_produce_output): temporary sets not empty(%d)\n",
71 size in bytes: merge %d ridge %d vertex %d facet %d\n\ 72 normal %d ridge vertices %d facet vertices or neighbors %d\n",
78 qh_fprintf(qh, qh->
ferr, 6065,
"qhull internal error (qh_produce_output2): temporary sets not empty(%d)\n",
95 if (facet->
id ==
id) {
113 if (vertex->
id ==
id) {
134 if (a->
f.
area >
b->f.area)
136 else if (a->
f.
area ==
b->f.area)
165 if (!(j=
b->visitid))
196 if (length > size + 1) {
197 qh_fprintf(qh, qh->
ferr, 6040,
"qhull error: filename is more than %d characters, %s\n", size-1, source);
200 strncpy(filename, source, length);
201 filename[length]=
'\0';
202 if (c ==
'\'' || c ==
'"') {
203 char *s= filename + 1;
245 int *numfacetsp,
int *numsimplicialp,
int *totneighborsp,
int *numridgesp,
int *numcoplanarsp,
int *numtricoplanarsp) {
247 int numfacets= 0, numsimplicial= 0, numridges= 0, totneighbors= 0, numcoplanars= 0, numtricoplanars= 0;
285 *numfacetsp= numfacets;
286 *numsimplicialp= numsimplicial;
287 *totneighborsp= totneighbors;
288 *numridgesp= numridges;
289 *numcoplanarsp= numcoplanars;
290 *numtricoplanarsp= numtricoplanars;
336 int i, k, pointid, pointidA, point_i, point_n;
338 pointT *point, **pointp, *point0, *midpoint, *normal, *inpoint;
339 coordT *coord, *gmcoord, *normalp;
345 realT dist, offset, angle, zero= 0.0;
348 for (k=0; k < dim; k++)
349 midpoint[k]= (vertex->
point[k] + vertexA->
point[k])/2;
360 if (numcenters > dim) {
367 }
else if (numcenters == dim) {
372 qh_fprintf(qh, qh->
ferr, 6216,
"qhull internal error (qh_detvnorm): too few points(%d) to compute separating plane\n", numcenters);
382 if (point != point0) {
386 *(gmcoord++)= *point++ - *coord++;
392 normal, &offset, &nearzero);
394 inpoint= vertexA->
point;
396 inpoint= vertex->
point;
403 *normalp= -(*normalp);
418 trace4((qh, qh->
ferr, 4014,
"qh_detvnorm: points %d %d midpoint dist %2.2g\n",
419 pointid, pointidA, dist));
420 for (k=0; k < dim; k++)
421 midpoint[k]= vertexA->
point[k] - vertex->
point[k];
430 trace4((qh, qh->
ferr, 4015,
"qh_detvnorm: points %d %d angle %2.2g nearzero %d\n",
431 pointid, pointidA, angle, nearzero));
442 if (simplex != points) {
453 trace4((qh, qh->
ferr, 4016,
"qh_detvnorm: points %d %d Voronoi vertex %d dist %2.2g\n",
454 pointid, pointidA, facet->
visitid, dist));
460 if (simplex != points)
480 facetT *neighbor, **neighborp;
484 if (neighbor->
seen) {
488 }
else if (firstinf) {
522 facetT *neighbor, **neighborp, *facet= NULL;
528 if (!neighbor->
seen2) {
535 if (neighbor->
seen) {
539 }
else if (firstinf) {
545 if (!neighbor->
seen2) {
556 if (!neighbor->
seen2) {
557 qh_fprintf(qh, qh->
ferr, 6217,
"qhull internal error (qh_detvridge3): neighbors of vertex p%d are not connected at facet %d\n",
621 facetT *neighbor, **neighborp, *neighborA, **neighborAp;
627 unsigned int numfacets= (
unsigned int)qh->
num_facets;
637 if (neighbor->
visitid < numfacets)
641 if (neighbor->
seen) {
649 if (neighborA->
seen) {
653 }
else if (firstinf) {
670 trace4((qh, qh->
ferr, 4017,
"qh_eachvoronoi: Voronoi ridge of %d vertices between sites %d and %d\n",
672 if (printvridge && fp) {
677 (*printvridge)(
qh, fp, atvertex, vertex, centers, unbounded);
744 !
qh_ALL, innerouter, inorder);
807 if (facetlist == qh->
facet_list && allfacets && !facets) {
857 *outerplane += radius;
858 *innerplane -= radius;
864 *innerplane= *outerplane= 0;
896 trace2((qh, qh->
ferr, 2006,
"qh_markkeep: only keep %d largest and/or %d most merged facets and/or min area %.2g\n",
906 if ((count= size - qh->
KEEParea) > 0) {
1012 *numcentersp= numcenters;
1013 trace2((qh, qh->
ferr, 2007,
"qh_markvoronoi: isLower %d numcenters %d\n", isLower, numcenters));
1034 facetT *facet, *neighbor, **neighborp;
1036 trace4((qh, qh->
ferr, 4018,
"qh_order_vertexneighbors: order neighbors of v%d for 3-d\n", vertex->
id));
1050 qh_fprintf(qh, qh->
ferr, 6066,
"qhull internal error (qh_order_vertexneighbors): no neighbor of v%d for f%d\n",
1051 vertex->
id, facet->
id);
1114 realT color[4], offset, dist, outerplane, innerplane;
1116 coordT *point, *normp, *coordp, **pointp, *feasiblep;
1119 facetT *neighbor, **neighborp;
1153 color[k]= (facet->
normal[k]+1.0)/2.0;
1189 offset= facet->
offset - innerplane;
1190 goto LABELprintnorm;
1197 goto LABELprintnorm;
1201 offset= facet->
offset - outerplane;
1204 qh_fprintf(qh, fp, 9017,
"no normal for facet f%d\n", facet->
id);
1234 qh_fprintf(qh, qh->
ferr, 6067,
"qhull input error (qh_printafacet): option 'Fp' needs qh->feasible_point\n");
1238 goto LABELprintinfinite;
1244 *(coordp++)= (*(normp++) / - facet->
offset) + *(feasiblep++);
1248 &zerodiv) + *(feasiblep++);
1251 goto LABELprintinfinite;
1310 int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars;
1315 pointT *point, **pointp, *pointtemp;
1318 qh_countfacets(qh, facetlist, facets, printall, &numfacets, &numsimplicial,
1319 &totneighbors, &numridges, &numcoplanars, &numtricoplanars);
1345 qh_fprintf(qh, qh->
ferr, 7049,
"qhull warning: output for ridges and intersections not implemented in 2-d\n");
1348 qh_fprintf(qh, qh->
ferr, 7050,
"qhull warning: output for outer/inner planes and centrums not implemented in 4-d\n");
1350 qh_fprintf(qh, qh->
ferr, 7051,
"qhull warning: output for vertices not implemented in 4-d\n");
1352 qh_fprintf(qh, qh->
ferr, 7052,
"qhull warning: 'Gnh' generates no output in 4-d\n");
1354 qh_fprintf(qh, fp, 9036,
"{appearance {linewidth 3} LIST # %s | %s\n",
1357 qh_fprintf(qh, fp, 9037,
"{appearance {+edge -evert linewidth 2} LIST # %s | %s\n",
1377 qh_fprintf(qh, fp, 9039,
"4VECT %d %d 1\n", num, num);
1379 qh_fprintf(qh, fp, 9040,
"VECT %d %d 1\n", num, num);
1381 for (i=num; i--; ) {
1386 qh_fprintf(qh, fp, 9043,
"# 1 point per line\n1 ");
1387 for (i=num-1; i--; ) {
1392 qh_fprintf(qh, fp, 9046,
"# 1 color for all\n");
1407 qh_fprintf(qh, fp, 9047,
"0 1 1 1 # color of points\n");
1478 qh_fprintf(qh, qh->
ferr, 7053,
"qhull warning: writing Delaunay. Use 'p' or 'o' for Voronoi centers\n");
1483 qh_fprintf(qh, fp, 9051,
"%d\n", numsimplicial+numridges);
1499 qh_fprintf(qh, qh->
ferr, 7054,
"qhull warning: output is the Delaunay triangulation\n");
1504 qh_fprintf(qh, fp, 9055,
"PLOT3D(POLYGONS(\n");
1524 qh_fprintf(qh, fp, 9060,
"%d\n%d %d %d\n", num,
1531 + numfacets - numsimplicial, numsimplicial + numridges, totneighbors/2);
1545 qh_fprintf(qh, fp, 9062,
"%d\n", numcoplanars);
1562 qh_fprintf(qh, qh->
ferr, 6068,
"qhull internal error (qh_printbegin): can not use this format for dimension %d\n",
1595 for (k=0; k < num; k++)
1598 for (k=0; k < num; k++)
1607 for (k=0; k < num; k++)
1628 pointT *centrum, *projpt;
1630 realT xaxis[4], yaxis[4], normal[4], dist;
1631 realT green[3]={0, 1, 0};
1643 qh_fprintf(qh, fp, 9072,
"{appearance {-normal -edge normscale 0} ");
1646 qh_fprintf(qh, fp, 9073,
"{INST geom { define centrum CQUAD # f%d\n\ 1647 -0.3 -0.3 0.0001 0 0 1 1\n\ 1648 0.3 -0.3 0.0001 0 0 1 1\n\ 1649 0.3 0.3 0.0001 0 0 1 1\n\ 1650 -0.3 0.3 0.0001 0 0 1 1 } transform { \n", facet->
id);
1652 qh_fprintf(qh, fp, 9074,
"{INST geom { : centrum } transform { # f%d\n", facet->
id);
1657 xaxis[k]= projpt[k] - centrum[k];
1658 normal[k]= facet->
normal[k];
1669 qh_fprintf(qh, fp, 9075,
"%8.4g %8.4g %8.4g 0\n", xaxis[0], xaxis[1], xaxis[2]);
1670 qh_fprintf(qh, fp, 9076,
"%8.4g %8.4g %8.4g 0\n", yaxis[0], yaxis[1], yaxis[2]);
1671 qh_fprintf(qh, fp, 9077,
"%8.4g %8.4g %8.4g 0\n", normal[0], normal[1], normal[2]);
1695 qh_fprintf(qh, qh->
ferr, 7055,
"qhull warning: no facets printed\n");
1754 facetT *neighbor, **neighborp;
1764 for (i=0; i < 3; i++) {
1765 color[i]= (facet->
normal[i]+1.0)/2.0;
1775 qh_fprintf(qh, fp, 9084,
"3 %d %d %d %8.4g %8.4g %8.4g 1 # f%d f%d\n",
1776 3*num, 3*num+1, 3*num+2, color[0], color[1], color[2],
1777 facet->
id, neighbor->
id);
1786 qh_fprintf(qh, fp, 9085,
"3 %d %d %d %8.4g %8.4g %8.4g 1 #r%d f%d f%d\n",
1787 3*num, 3*num+1, 3*num+2, color[0], color[1], color[2],
1788 ridge->
id, facet->
id, neighbor->
id);
1809 setT *vertices, *points;
1813 int numpoints=0, point_i, point_n;
1848 int numfacets, numridges, totneighbors, numcoplanars, numsimplicial, numtricoplanars;
1850 facetT *facet, *startfacet, *nextfacet;
1853 qh_countfacets(qh, facetlist, facets, printall, &numfacets, &numsimplicial,
1854 &totneighbors, &numridges, &numcoplanars, &numtricoplanars);
1874 qh_fprintf(qh, qh->
ferr, 6218,
"Qhull internal error (qh_printextremes_2d): loop in facet list. facet %d nextfacet %d\n",
1875 facet->
id, nextfacet->
id);
1890 }
while (facet && facet != startfacet);
1907 boolT upperseen, lowerseen;
1908 facetT *neighbor, **neighborp;
1914 upperseen= lowerseen=
False;
1921 if (upperseen && lowerseen) {
1965 realT mindist, innerplane, outerplane;
1975 color[k]= 1.0 - color[k];
1993 qh_fprintf(qh, fp, 9093,
"VECT 1 2 1 2 1 # f%d\n", facet->
id);
1994 if (offset != 0.0) {
1998 qh_fprintf(qh, fp, 9094,
"%8.4g %8.4g %8.4g\n%8.4g %8.4g %8.4g\n",
1999 p1[0], p1[1], 0.0, p2[0], p2[1], 0.0);
2000 if (offset != 0.0) {
2004 qh_fprintf(qh, fp, 9095,
"%8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
2022 const char *pointfmt;
2028 pointfmt=
"[[%16.8f, %16.8f], [%16.8f, %16.8f]]\n";
2030 pointfmt=
"Line[{{%16.8f, %16.8f}, {%16.8f, %16.8f}}]\n";
2031 qh_fprintf(qh, fp, 9097, pointfmt, point0[0], point0[1], point1[0], point1[1]);
2049 setT *projectedpoints, *vertices;
2050 vertexT *vertex, **vertexp, *vertexA, *vertexB;
2051 pointT *projpt, *point, **pointp;
2053 realT dist, outerplane, innerplane;
2055 realT black[3]={0, 0, 0}, green[3]={0, 1, 0};
2060 projectedpoints=
qh_settemp(qh, cntvertices);
2072 color[k]= 1.0 - color[k];
2110 qh_fprintf(qh, fp, 9098,
"{ OFF %d 1 1 # f%d\n", n, facet->
id);
2111 if (offset != 0.0) {
2116 printpoints= points;
2122 qh_fprintf(qh, fp, 9100,
"%8.4g ", point[k]);
2124 if (printpoints != points)
2128 if (printpoints != points)
2131 for (i=0; i < n; i++)
2133 qh_fprintf(qh, fp, 9104,
"%8.4g %8.4g %8.4g 1.0 }\n", color[0], color[1], color[2]);
2152 setT *points, *vertices;
2153 vertexT *vertex, **vertexp, *vertexA, *vertexB;
2154 facetT *neighbor, **neighborp;
2155 realT outerplane, innerplane;
2156 realT black[3]={0, 0, 0}, green[3]={0, 1, 0};
2169 color[k]= 1.0 - color[k];
2207 setT *points, *vertices;
2211 const char *pointfmt, *endfmt;
2225 pointfmt=
"[%16.8f, %16.8f, %16.8f]";
2229 pointfmt=
"{%16.8f, %16.8f, %16.8f}";
2237 qh_fprintf(qh, fp, 9109, pointfmt, point[0], point[1], point[2]);
2304 qh_fprintf(qh, fp, 9114,
"OFF 3 1 1 # f%d\n", facet->
id);
2307 qh_fprintf(qh, fp, 9115,
"# r%d between f%d f%d\n", ridge->
id, facet->
id, neighbor->
id);
2315 qh_fprintf(qh, fp, 9116,
"%8.4g ", point[k]);
2321 qh_fprintf(qh, fp, 9118,
"3 0 1 2 %8.4g %8.4g %8.4g\n", color[0], color[1], color[2]);
2339 facetT *neighbor, **neighborp;
2357 qh_fprintf(qh, fp, 9119,
"OFF 3 1 1 # ridge between f%d f%d\n",
2358 facet->
id, neighbor->
id);
2361 qh_fprintf(qh, fp, 9120,
"# ridge between f%d f%d\n", facet->
id, neighbor->
id);
2371 qh_fprintf(qh, fp, 9123,
"3 0 1 2 %8.4g %8.4g %8.4g\n", color[0], color[1], color[2]);
2444 pointT *point, **pointp, *furthest;
2445 facetT *neighbor, **neighborp;
2452 qh_fprintf(qh, fp, 9134,
" DUPLICATEridge\n");
2539 #if !qh_COMPUTEfurthest 2557 qh_fprintf(qh, fp, 9173,
" furthest distance= %2.2g\n", dist);
2560 qh_fprintf(qh, fp, 9174,
" - neighboring facets:");
2587 facetT *neighbor, **neighborp;
2593 qh_fprintf(qh, fp, 9179,
" - ridges(ids may be garbage):");
2603 while (ridge && !ridge->
seen) {
2644 int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars;
2648 realT outerplane, innerplane;
2653 qh_fprintf(qh, qh->
ferr, 7056,
"qhull warning: CDD format is not available for centrums, halfspace\nintersections, and OFF file format.\n");
2682 qh_countfacets(qh, facetlist, facets, printall, &numfacets, &numsimplicial,
2683 &totneighbors, &numridges, &numcoplanars, &numtricoplanars);
2688 qh_setsize(qh, vertices), numfacets, numcoplanars,
2701 qh_printend(qh, fp, format, facetlist, facets, printall);
2711 qh_printend(qh, fp, format, facetlist, facets, printall);
2725 realT costheta, denominator, dist1, dist2, s,
t, mindenom, p[4];
2728 boolT nearzero1, nearzero2;
2731 denominator= 1 - costheta * costheta;
2734 qh_fprintf(qh, fp, 9195,
"VECT 1 %d 1 %d 1 ", i, i);
2739 qh_fprintf(qh, fp, 9197,
"# intersect f%d f%d\n", facet1->
id, facet2->
id);
2745 s=
qh_divzero(-dist1 + costheta * dist2, denominator,mindenom,&nearzero1);
2746 t=
qh_divzero(-dist2 + costheta * dist1, denominator,mindenom,&nearzero2);
2747 if (nearzero1 || nearzero2)
2753 qh_fprintf(qh, fp, 9198,
"%8.4g %8.4g %8.4g # ", p[0], p[1], p[2]);
2755 qh_fprintf(qh, fp, 9199,
"%8.4g %8.4g %8.4g %8.4g # ", p[0], p[1], p[2], p[3]);
2756 if (nearzero1+nearzero2)
2762 qh_fprintf(qh, fp, 9202,
"%8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
2764 qh_fprintf(qh, fp, 9203,
"3 0 1 2 %8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
2784 if ((fabs(pA[0] - pB[0]) > 1e-3) ||
2785 (fabs(pA[1] - pB[1]) > 1e-3) ||
2786 (fabs(pA[2] - pB[2]) > 1e-3)) {
2787 qh_fprintf(qh, fp, 9204,
"VECT 1 2 1 2 1\n");
2788 for (k=0; k < 3; k++)
2792 qh_fprintf(qh, fp, 9207,
"VECT 1 1 1 1 1\n");
2793 for (k=0; k < 3; k++)
2796 qh_fprintf(qh, fp, 9210,
"%8.4g %8.4g %8.4g 1\n", color[0], color[1], color[2]);
2810 facetT *neighbor, **neighborp, *facet;
2816 if (facetA == facetB)
2820 for (facet= facetA; facet; facet= ((facet == facetA) ? facetB : NULL)) {
2869 for (k=dim; k--; ) {
2890 for (k=0; k < 3; k++)
2914 int numpoints=0, point_i, point_n;
2915 setT *vertices, *points;
2979 realT diff[4], pointA[4];
2984 diff[k]= point[k]-center[k];
2993 pointA[k]= point[k]+diff[k] * radius;
3004 realT red[3]={1, 0, 0}, yellow[3]={1, 1, 0};
3030 qh_fprintf(qh, fp, 9226,
" between f%d and f%d\n",
3047 qh_fprintf(qh, fp, 9227,
"{appearance {-edge -normal normscale 0} {\n\ 3048 INST geom {define vsphere OFF\n\ 3057 0.707107 0 0.707107\n\ 3058 0 -0.707107 0.707107\n\ 3059 0.707107 -0.707107 0\n\ 3060 -0.707107 0 0.707107\n\ 3061 -0.707107 -0.707107 0\n\ 3062 0 0.707107 0.707107\n\ 3063 -0.707107 0.707107 0\n\ 3064 0.707107 0.707107 0\n\ 3065 0.707107 0 -0.707107\n\ 3066 0 0.707107 -0.707107\n\ 3067 -0.707107 0 -0.707107\n\ 3068 0 -0.707107 -0.707107\n\ 3101 3 17 10 16\n} transforms { TLIST\n");
3103 qh_fprintf(qh, fp, 9228,
"%8.4g 0 0 0 # v%d\n 0 %8.4g 0 0\n0 0 %8.4g 0\n",
3104 radius, vertex->
id, radius, radius);
3141 int totcount, numcenters;
3156 qh_fprintf(qh, qh->
ferr, 6219,
"Qhull internal error (qh_printvdiagram): unknown print format %d.\n", format);
3159 vertices=
qh_markvoronoi(qh, facetlist, facets, printall, &isLower, &numcenters);
3202 int vertex_i, vertex_n;
3227 facetT *neighbor, **neighborp;
3235 point= vertex->
point;
3250 if (++count % 100 == 0)
3313 int numfacets, numsimplicial, numridges, totneighbors, numneighbors, numcoplanars, numtricoplanars;
3314 setT *vertices, *vertex_points, *coplanar_points;
3317 int vertex_i, vertex_n;
3318 facetT *facet, **facetp, *neighbor, **neighborp;
3321 qh_countfacets(qh, facetlist, facets, printall, &numfacets, &numsimplicial,
3322 &totneighbors, &numridges, &numcoplanars, &numtricoplanars);
3329 qh_setzero(qh, coplanar_points, 0, numpoints);
3343 qh_fprintf(qh, fp, 9249,
"%d", numneighbors);
3388 int k, numcenters, numvertices= 0, numneighbors, numinf, vid=1, vertex_i, vertex_n;
3389 facetT *facet, **facetp, *neighbor, **neighborp;
3393 unsigned int numfacets= (
unsigned int) qh->
num_facets;
3395 vertices=
qh_markvoronoi(qh, facetlist, facets, printall, &isLower, &numcenters);
3399 numneighbors = numinf = 0;
3403 else if (neighbor->
visitid < numfacets)
3406 if (numinf && !numneighbors) {
3407 SETelem_(vertices, vertex_i)= NULL;
3413 qh_fprintf(qh, fp, 9254,
"{appearance {+edge -face} OFF %d %d 1 # Voronoi centers and cells\n",
3414 numcenters, numvertices);
3420 qh_fprintf(qh, fp, 9257,
" 0 # infinity not used\n");
3429 qh_fprintf(qh, fp, 9260,
"# %d f%d\n", vid++, facet->
id);
3436 qh_fprintf(qh, fp, 9261,
"# %d f%d\n", vid++, facet->
id);
3453 else if (neighbor->
visitid < numfacets)
3459 qh_fprintf(qh, fp, 9262,
"%d", numneighbors);
3464 qh_fprintf(qh, fp, 9264,
" # p%d(v%d)\n", vertex_i, vertex->
id);
3466 qh_fprintf(qh, fp, 9265,
" # p%d is coplanar or isolated\n", vertex_i);
3470 qh_fprintf(qh, fp, 9266,
"%d", numneighbors);
3478 }
else if (neighbor->
visitid < numfacets)
3513 normal=
qh_detvnorm(qh, vertex, vertexA, centers, &offset);
3561 for (k=0, i=0; k < qh->
hull_dim; k++) {
3564 destination[i++]= source[k];
3566 destination[i++]= 0;
3568 destination[i++]= source[k];
3571 destination[i++]= 0.0;
3593 int linecount= 0, tokcount= 0;
3599 qh_fprintf(qh, qh->
ferr, 6070,
"qhull input error: feasible point(dim 1 coords) is only valid for halfspace intersection\n");
3603 qh_fprintf(qh, qh->
ferr, 7057,
"qhull input warning: feasible point(dim 1 coords) overrides 'Hn,n,n' feasible point for halfspace intersection\n");
3605 qh_fprintf(qh, qh->
ferr, 6071,
"qhull error: insufficient memory for feasible point\n");
3609 while ((s= (isfirst ? curline : fgets(firstline,
qh_MAXfirst, qh->
fin)))) {
3622 if (++tokcount == dim) {
3627 qh_fprintf(qh, qh->
ferr, 6072,
"qhull input error: coordinates for feasible point do not finish out the line: %s\n",
3635 qh_fprintf(qh, qh->
ferr, 6073,
"qhull input error: only %d coordinates. Could not read %d-d feasible point.\n",
3674 coordT *points, *coords, *infinity= NULL;
3676 realT *coordp= NULL, *offsetp= NULL, *normalp= NULL;
3678 int diminput=0, numinput=0, dimfeasible= 0, newnum, k, tempi;
3679 int firsttext=0, firstshort=0, firstlong=0, firstpoint=0;
3680 int tokcount= 0, linecount=0, maxcount, coordcount=0;
3687 if (qh->
HALFspace && linecount == 1 && isdigit(*s)) {
3695 }
else if (!memcmp(firstline,
"begin", (
size_t)5) || !memcmp(firstline,
"BEGIN", (
size_t)5))
3701 qh_fprintf(qh, qh->
ferr, 6074,
"qhull input error: missing \"begin\" for cdd-formated input\n");
3705 while (!numinput && (s= fgets(firstline,
qh_MAXfirst, qh->
fin))) {
3707 if (!memcmp(s,
"begin", (
size_t)5) || !memcmp(s,
"BEGIN", (
size_t)5))
3717 firsttext= linecount;
3727 dimfeasible= diminput;
3728 diminput= numinput= 0;
3735 qh_fprintf(qh, qh->
ferr, 6075,
"qhull input error: short input file. Did not find dimension and number of points\n");
3738 if (diminput > numinput) {
3744 qh_fprintf(qh, qh->
ferr, 6220,
"qhull input error: dimension %d(first number) should be at least 2\n",
3751 *dimension= diminput;
3753 *dimension= diminput+1;
3754 *numpoints= numinput;
3758 *dimension= diminput - 1;
3759 *numpoints= numinput;
3761 qh_fprintf(qh, qh->
ferr, 6221,
"qhull input error: dimension %d(first number, includes offset) should be at least 3 for halfspaces\n",
3766 if (dimfeasible != *dimension) {
3767 qh_fprintf(qh, qh->
ferr, 6222,
"qhull input error: dimension %d of feasible point is not one less than dimension %d for halfspaces\n",
3768 dimfeasible, diminput);
3775 *dimension= diminput-1;
3777 *dimension= diminput;
3778 *numpoints= numinput;
3785 normalp= offsetp + 1;
3788 offsetp= normalp + *dimension;
3798 qh_fprintf(qh, qh->
ferr, 6076,
"qhull error: insufficient memory to read %d points\n",
3803 infinity= points + numinput * (*dimension);
3804 for (k= (*dimension) - 1; k--; )
3807 maxcount= numinput * diminput;
3809 while ((s= (isfirst ? s : fgets(qh->
line, qh->
maxline, qh->
fin)))) {
3812 if (*s ==
'e' || *s ==
'E') {
3813 if (!memcmp(s,
"end", (
size_t)3) || !memcmp(s,
"END", (
size_t)3)) {
3817 qh_fprintf(qh, qh->
ferr, 7058,
"qhull input warning: the input appears to be in cdd format. If so, use 'Fd'\n");
3829 if (*s && !firsttext)
3830 firsttext= linecount;
3831 if (!islong && !firstshort && coordcount)
3832 firstshort= linecount;
3836 firstpoint= linecount;
3838 if (++tokcount > maxcount)
3842 *(coordp++)= -value;
3849 qh_fprintf(qh, qh->
ferr, 6077,
"qhull input error: for cdd format, point at line %d does not start with '1'\n",
3854 }
else if (isdelaunay) {
3855 paraboloid += value * value;
3858 infinity[coordcount-1] += value;
3860 infinity[coordcount] += value;
3864 if (++coordcount == diminput) {
3867 *(coords++)= paraboloid;
3872 qh_fprintf(qh, qh->
ferr, 8048,
"The halfspace was on line %d\n", linecount);
3874 qh_fprintf(qh, qh->
ferr, 8049,
"The input appears to be in cdd format. If so, you should use option 'Fd'\n");
3884 firstlong= linecount;
3888 if (!islong && !firstshort && coordcount)
3889 firstshort= linecount;
3891 qh_fprintf(qh, qh->
ferr, 6078,
"qhull input error: line %d contained more than %d characters\n",
3892 linecount, (
int) (s - qh->
line));
3897 if (tokcount != maxcount) {
3898 newnum=
fmin_(numinput, tokcount/diminput);
3900 qhull warning: instead of %d %d-dimensional points, input contains\n\ 3901 %d points and %d extra coordinates. Line %d is the first\npoint",
3902 numinput, diminput, tokcount/diminput, tokcount % diminput, firstpoint);
3904 qh_fprintf(qh, qh->
ferr, 8051,
", line %d is the first comment", firsttext);
3906 qh_fprintf(qh, qh->
ferr, 8052,
", line %d is the first short\nline", firstshort);
3908 qh_fprintf(qh, qh->
ferr, 8053,
", line %d is the first long line", firstlong);
3909 qh_fprintf(qh, qh->
ferr, 8054,
". Continue with %d points.\n", newnum);
3912 for (k= tokcount % diminput; k--; )
3913 infinity[k] -= *(--coords);
3914 *numpoints= newnum+1;
3916 coords -= tokcount % diminput;
3921 for (k= (*dimension) -1; k--; )
3922 infinity[k] /= numinput;
3923 if (coords == infinity)
3924 coords += (*dimension) -1;
3926 for (k=0; k < (*dimension) -1; k++)
3927 *(coords++)= infinity[k];
3929 *(coords++)= maxboloid * 1.1;
3935 This is the qhull test case. If any errors or core dumps occur,\n\ 3936 recompile qhull with 'make new'. If errors still occur, there is\n\ 3937 an incompatibility. You should try a different compiler. You can also\n\ 3938 change the choices in user.h. If you discover the source of the problem,\n\ 3939 please send mail to qhull_bug@qhull.org.\n\ 3941 Type 'qhull' for a short list of options.\n");
3950 trace1((qh, qh->
ferr, 1008,
"qh_readpoints: read in %d %d-dimensional points\n",
3951 numinput, diminput));
3974 qhull input error: halfspace intersection needs a feasible point.\n\ 3975 Either prepend the input with 1 point or use 'Hn,n,n'. See manual.\n");
3979 qh_fprintf(qh, qh->
ferr, 6079,
"qhull error: insufficient memory for 'Hn,n,n'\n");
3985 if (++tokcount > dim) {
3986 qh_fprintf(qh, qh->
ferr, 7059,
"qhull input warning: more coordinates for 'H%s' than dimension %d\n",
3994 while (++tokcount <= dim)
4008 facetT *neighbor, **neighborp;
4019 return !facet->
good;
4041 while (*s && isspace(*s))
4045 qh_fprintf(qh, qh->
ferr, 6204,
"qhull input error: filename expected, none found.\n");
4048 if (c ==
'\'' || c ==
'"') {
4049 while (*s !=c || s[-1] ==
'\\') {
4051 qh_fprintf(qh, qh->
ferr, 6203,
"qhull input error: missing quote after filename -- %s\n", filename);
4058 else while (*s && !isspace(*s))
void qh_printfacet2geom_points(qhT *qh, FILE *fp, pointT *point1, pointT *point2, facetT *facet, realT offset, realT color[3])
void qh_printfacetNvertex_nonsimplicial(qhT *qh, FILE *fp, facetT *facet, int id, qh_PRINT format)
void qh_printvnorm(qhT *qh, FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded)
setT * qh_detvridge(qhT *qh, vertexT *vertex)
void qh_printstatistics(FILE *fp, const char *string)
void * qh_malloc(size_t size)
double qh_strtod(const char *s, char **endp)
void qh_setfeasible(qhT *qh, int dim)
void qh_printvertexlist(qhT *qh, FILE *fp, const char *string, facetT *facetlist, setT *facets, boolT printall)
void qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0, boolT toporient, coordT *normal, coordT *offset, boolT *nearzero)
setT * qh_pointvertex(void)
void qh_settruncate(setT *set, int size)
pointT * qh_getcenter(setT *vertices)
#define otherfacet_(ridge, facet)
void qh_printfacet3math(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format, int notfirst)
void qh_countfacets(qhT *qh, facetT *facetlist, setT *facets, boolT printall, int *numfacetsp, int *numsimplicialp, int *totneighborsp, int *numridgesp, int *numcoplanarsp, int *numtricoplanarsp)
#define FOREACHvertex_(vertices)
void qh_printvdiagram(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall)
void qh_dfacet(qhT *qh, unsigned id)
void qh_printpointvect(qhT *qh, FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3])
int qh_compare_facetmerge(const void *p1, const void *p2)
qh_PRINT PRINTout[qh_PRINTEND]
#define SETfirstt_(set, type)
void qh_produce_output(qhT *qh)
void qh_printafacet(qhT *qh, FILE *fp, qh_PRINT format, facetT *facet, boolT printall)
void qh_fprintf(FILE *fp, int msgcode, const char *fmt,...)
void qh_printridge(qhT *qh, FILE *fp, ridgeT *ridge)
void qh_printline3geom(qhT *qh, FILE *fp, pointT *pointA, pointT *pointB, realT color[3])
#define FORALLfacet_(facetlist)
pointT * qh_detvnorm(qhT *qh, vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp)
void qh_printstats(FILE *fp, int idx, int *nextindex)
void qh_printvridge(qhT *qh, FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded)
int qh_strtol(const char *s, char **endp)
void qh_printfacet3geom_simplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3])
void qh_printcenter(qhT *qh, FILE *fp, qh_PRINT format, const char *string, facetT *facet)
setT * qh_markvoronoi(qhT *qh, facetT *facetlist, setT *facets, boolT printall, boolT *isLowerp, int *numcentersp)
realT qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp)
int qh_pointid(pointT *point)
void qh_produce_output2(qhT *qh)
void qh_copyfilename(qhT *qh, char *filename, int size, const char *source, int length)
#define qh_DUPLICATEridge
void qh_printvneighbors(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall)
setT * qh_settemppop(void)
void qh_printpoint3(qhT *qh, FILE *fp, pointT *point)
int qh_setin(setT *set, void *setelem)
void qh_printfacet(qhT *qh, FILE *fp, facetT *facet)
void qh_triangulate(void)
boolT qh_sethalfspace(int dim, coordT *coords, coordT **nextp, coordT *normal, coordT *offset, coordT *feasible)
void qh_dvertex(qhT *qh, unsigned id)
boolT qh_inthresholds(coordT *normal, realT *angle)
realT qh_getangle(pointT *vect1, pointT *vect2)
void qh_printcentrum(qhT *qh, FILE *fp, facetT *facet, realT radius)
void qh_markkeep(qhT *qh, facetT *facetlist)
void qh_allstatistics(void)
void qh_clearcenters(qh_CENTER type)
void qh_printfacet3vertex(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format)
void qh_printfacetNvertex_simplicial(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format)
char * qh_skipfilename(qhT *qh, char *filename)
void qh_printvertices(qhT *qh, FILE *fp, const char *string, setT *vertices)
void qh_printpoints(FILE *fp, const char *string, setT *points)
int qh_eachvoronoi(qhT *qh, FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder)
void qh_printbegin(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall)
void * qh_setlast(setT *set)
void qh_order_vertexneighbors(qhT *qh, vertexT *vertex)
void qh_printfacets(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall)
void qh_settempfree(setT **set)
void qh_printfacet2math(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format, int notfirst)
#define FOREACHvertex_i_(vertices)
#define FOREACHridge_(ridges)
void qh_printvertex(qhT *qh, FILE *fp, vertexT *vertex)
int qh_compare_facetvisit(const void *p1, const void *p2)
pointT * qh_getcentrum(facetT *facet)
#define maximize_(maxval, val)
void qh_errexit2(int exitcode, facetT *facet, facetT *otherfacet)
int qh_compare_facetarea(const void *p1, const void *p2)
setT * qh_setnew_delnthsorted(setT *set, int size, int nth, int prepend)
#define FOREACHneighborA_(facet)
void qh_printend4geom(qhT *qh, FILE *fp, facetT *facet, int *nump, boolT printall)
void qh_facet2point(qhT *qh, facetT *facet, pointT **point0, pointT **point1, realT *mindist)
void qh_printfacet3geom_points(qhT *qh, FILE *fp, setT *points, facetT *facet, realT offset, realT color[3])
void qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol)
void * qh_setdelnth(setT *set, int nth)
void qh_printfacetridges(qhT *qh, FILE *fp, facetT *facet)
void qh_printend(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall)
coordT * qh_readpoints(qhT *qh, int *numpoints, int *dimension, boolT *ismalloc)
void qh_prepare_output(qhT *qh)
void qh_setzero(setT *set, int idx, int size)
void qh_setfree(setT **setp)
setT * qh_facet3vertex(facetT *facet)
ridgeT * qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp)
void qh_printextremes_2d(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall)
#define FOREACHneighbor_(facet)
#define SETelemt_(set, n, type)
void qh_printextremes(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall)
setT * qh_detvridge3(qhT *qh, vertexT *atvertex, vertexT *vertex)
#define SETindex_(set, elem)
void qh_normalize(coordT *normal, int dim, boolT toporient)
void qh_setappend(setT **setp, void *newelem)
void(* printvridgeT)(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded)
int qh_readfeasible(qhT *qh, int dim, const char *curline)
void qh_collectstatistics(void)
void * qh_setdellast(setT *set)
#define FOREACHfacet_(facets)
void qh_memfree(void *object, int insize)
void qh_printsummary(FILE *fp)
void qh_printpointvect2(qhT *qh, FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius)
void qh_printpoints_out(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall)
unsigned int vertex_visit
void qh_checkpolygon(facetT *facetlist)
void qh_geomplanes(qhT *qh, facetT *facet, realT *outerplane, realT *innerplane)
void qh_printspheres(qhT *qh, FILE *fp, setT *vertices, realT radius)
void qh_printextremes_d(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall)
void qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane)
void qh_printfacetheader(qhT *qh, FILE *fp, facetT *facet)
void * qh_setdel(setT *set, void *oldelem)
setT * qh_facetvertices(qhT *qh, facetT *facetlist, setT *facets, boolT allfacets)
void qh_printfacet2geom(qhT *qh, FILE *fp, facetT *facet, realT color[3])
int qh_eachvoronoi_all(qhT *qh, FILE *fp, printvridgeT printvridge, boolT isUpper, qh_RIDGE innerouter, boolT inorder)
int qh_setunique(setT **set, void *elem)
void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge)
#define FOREACHvertexreverse12_(vertices)
void qh_printhyperplaneintersection(qhT *qh, FILE *fp, facetT *facet1, facetT *facet2, setT *vertices, realT color[3])
void qh_normalize2(coordT *normal, int dim, boolT toporient, realT *minnorm, boolT *ismin)
void qh_printfacet4geom_nonsimplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3])
void qh_vertexneighbors(void)
setT * qh_settemp(int setsize)
void qh_printpoint(qhT *qh, FILE *fp, const char *string, pointT *point)
realT qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv)
int qh_printvdiagram2(qhT *qh, FILE *fp, printvridgeT printvridge, setT *vertices, qh_RIDGE innerouter, boolT inorder)
void qh_printfacet4geom_simplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3])
void qh_printfacet3geom_nonsimplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3])
void qh_getarea(facetT *facetlist)
pointT * qh_projectpoint(pointT *point, facetT *facet, realT dist)
void qh_printneighborhood(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall)
void qh_point_add(setT *set, pointT *point, void *elem)
void * qh_memalloc(int insize)
void qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3])
void qh_distplane(pointT *point, facetT *facet, realT *dist)
int qh_setsize(setT *set)
void qh_projectdim3(qhT *qh, pointT *source, pointT *destination)
void qh_memstatistics(FILE *fp)
boolT qh_skipfacet(qhT *qh, facetT *facet)
#define SETaddr_(set, type)
void qh_printvoronoi(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall)
#define FOREACHpoint_(points)
void qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex)
void qh_printpointid(qhT *qh, FILE *fp, const char *string, int dim, pointT *point, int id)
#define FOREACHpoint_i_(points)
vertexT * qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp)
#define minimize_(minval, val)
void qh_findgood_all(facetT *facetlist)
#define SETsecondt_(set, type)
pointT * qh_facetcenter(setT *vertices)