Doxygen Source Code Documentation
qhull.h File Reference
#include <setjmp.h>
#include <float.h>
#include <time.h>
#include "user.h"
Go to the source code of this file.
Data Structures | |
struct | facetT |
struct | qhT |
struct | ridgeT |
struct | vertexT |
Defines | |
#define | qhDEFqhull 1 |
#define | coordT realT |
#define | pointT coordT |
#define | flagT unsigned int |
#define | boolT unsigned int |
#define | False 0 |
#define | True 1 |
#define | qh_ALL True |
#define | qh_NOupper True |
#define | qh_ERRnone 0 |
#define | qh_ERRinput 1 |
#define | qh_ERRsingular 2 |
#define | qh_ERRprec 3 |
#define | qh_ERRmem 4 |
#define | qh_ERRqhull 5 |
#define | DEFsetT 1 |
#define | qh_MAXnummerge 511 |
#define | qh qh_qh. |
#define | otherfacet_(ridge, facet) (((ridge)->top == (facet)) ? (ridge)->bottom : (ridge)->top) |
#define | getid_(p) ((p) ? (p)->id : -1) |
#define | FORALLfacets for (facet=qh facet_list;facet && facet->next;facet=facet->next) |
#define | FORALLpoints FORALLpoint_(qh first_point, qh num_points) |
#define | FORALLpoint_(points, num) |
#define | FORALLvertices for (vertex=qh vertex_list;vertex && vertex->next;vertex= vertex->next) |
#define | FOREACHfacet_(facets) FOREACHsetelement_(facetT, facets, facet) |
#define | FOREACHneighbor_(facet) FOREACHsetelement_(facetT, facet->neighbors, neighbor) |
#define | FOREACHpoint_(points) FOREACHsetelement_(pointT, points, point) |
#define | FOREACHridge_(ridges) FOREACHsetelement_(ridgeT, ridges, ridge) |
#define | FOREACHvertex_(vertices) FOREACHsetelement_(vertexT, vertices,vertex) |
#define | FOREACHfacet_i_(facets) FOREACHsetelement_i_(facetT, facets, facet) |
#define | FOREACHneighbor_i_(facet) FOREACHsetelement_i_(facetT, facet->neighbors, neighbor) |
#define | FOREACHpoint_i_(points) FOREACHsetelement_i_(pointT, points, point) |
#define | FOREACHridge_i_(ridges) FOREACHsetelement_i_(ridgeT, ridges, ridge) |
#define | FOREACHvertex_i_(vertices) FOREACHsetelement_i_(vertexT, vertices,vertex) |
Typedefs | |
typedef vertexT | vertexT |
typedef ridgeT | ridgeT |
typedef facetT | facetT |
typedef setT | setT |
typedef qhT | qhT |
Enumerations | |
enum | qh_CENTER { qh_ASnone = 0, qh_ASvoronoi, qh_AScentrum } |
enum | qh_PRINT { qh_PRINTnone = 0, qh_PRINTarea, qh_PRINTaverage, qh_PRINTcoplanars, qh_PRINTcentrums, qh_PRINTfacets, qh_PRINTfacets_xridge, qh_PRINTgeom, qh_PRINTids, qh_PRINTinner, qh_PRINTneighbors, qh_PRINTnormals, qh_PRINTouter, qh_PRINTincidences, qh_PRINTmathematica, qh_PRINTmerges, qh_PRINToff, qh_PRINToptions, qh_PRINTpointintersect, qh_PRINTpointnearest, qh_PRINTpoints, qh_PRINTqhull, qh_PRINTsize, qh_PRINTsummary, qh_PRINTtriangles, qh_PRINTvertices, qh_PRINTvneighbors, qh_PRINTextremes, qh_PRINTEND } |
Functions | |
void | qh_qhull (void) |
boolT | qh_addpoint (pointT *furthest, facetT *facet, boolT checkdist) |
void | qh_printsummary (FILE *fp) |
void | qh_errexit (int exitcode, facetT *facet, ridgeT *ridge) |
void | qh_errprint (char *string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex) |
int | qh_new_qhull (int dim, int numpoints, coordT *points, boolT ismalloc, char *qhull_cmd, FILE *outfile, FILE *errfile) |
void | qh_printfacetlist (facetT *facetlist, setT *facets, boolT printall) |
void | qh_user_memsizes (void) |
facetT * | qh_findbest (pointT *point, facetT *startfacet, boolT bestoutside, boolT newfacets, boolT noupper, realT *dist, boolT *isoutside, int *numpart) |
facetT * | qh_findbestnew (pointT *point, facetT *startfacet, realT *dist, boolT *isoutside, int *numpart) |
boolT | qh_gram_schmidt (int dim, realT **rows) |
void | qh_outerinner (facetT *facet, realT *outerplane, realT *innerplane) |
void | qh_projectinput (void) |
void | qh_randommatrix (realT *buffer, int dim, realT **row) |
void | qh_rotateinput (realT **rows) |
void | qh_scaleinput (void) |
void | qh_setdelaunay (int dim, int count, pointT *points) |
coordT * | qh_sethalfspace_all (int dim, int count, coordT *halfspaces, pointT *feasible) |
unsigned long | qh_clock (void) |
void | qh_checkflags (char *command, char *hiddenflags) |
void | qh_freebuffers (void) |
void | qh_freeqhull (boolT allmem) |
void | qh_init_A (FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[]) |
void | qh_init_B (coordT *points, int numpoints, int dim, boolT ismalloc) |
void | qh_init_qhull_command (int argc, char *argv[]) |
void | qh_initbuffers (coordT *points, int numpoints, int dim, boolT ismalloc) |
void | qh_initflags (char *command) |
void | qh_initqhull_buffers (void) |
void | qh_initqhull_globals (coordT *points, int numpoints, int dim, boolT ismalloc) |
void | qh_initqhull_mem (void) |
void | qh_initqhull_start (FILE *infile, FILE *outfile, FILE *errfile) |
void | qh_initthresholds (char *command) |
void | dfacet (unsigned id) |
void | dvertex (unsigned id) |
void | qh_printneighborhood (FILE *fp, int format, facetT *facetA, facetT *facetB, boolT printall) |
void | qh_produce_output (void) |
coordT * | qh_readpoints (int *numpoints, int *dimension, boolT *ismalloc) |
void | qh_meminit (FILE *ferr) |
void | qh_memfreeshort (int *curlong, int *totlong) |
void | qh_check_output (void) |
void | qh_check_points (void) |
setT * | qh_facetvertices (facetT *facetlist, setT *facets, boolT allfacets) |
facetT * | qh_findbestfacet (pointT *point, boolT bestoutside, realT *bestdist, boolT *isoutside) |
vertexT * | qh_nearvertex (facetT *facet, pointT *point, realT *bestdistp) |
pointT * | qh_point (int id) |
setT * | qh_pointfacet (void) |
int | qh_pointid (pointT *point) |
setT * | qh_pointvertex (void) |
void | qh_setvoronoi_all (void) |
void | qh_collectstatistics (void) |
void | qh_printallstatistics (FILE *fp, char *string) |
Variables | |
char | qh_version [] |
qhT | qh_qh |
Define Documentation
|
|
|
|
|
|
|
|
|
|
Value: for(point= (points), \ pointtemp= (points)+qh hull_dim*(num); point < pointtemp; point += qh hull_dim) Definition at line 758 of file qhull.h. Referenced by qh_detjoggle(), qh_maxmin(), and qh_maxsimplex(). |
|
Definition at line 747 of file qhull.h. Referenced by qh_check_points(), and qh_printbegin(). |
|
Definition at line 773 of file qhull.h. Referenced by dvertex(), qh_all_merges(), qh_buildhull(), qh_buildtracing(), qh_check_maxout(), qh_checkpolygon(), qh_collectstatistics(), qh_eachvoronoi(), qh_eachvoronoi_all(), qh_facetvertices(), qh_freebuild(), qh_pointvertex(), qh_postmerge(), qh_printlists(), and qh_printvdiagram2(). |
|
Definition at line 787 of file qhull.h. Referenced by qh_countfacets(), qh_detvnorm(), qh_facetvertices(), qh_markkeep(), qh_markvoronoi(), qh_printbegin(), qh_printend(), qh_printfacetlist(), qh_printfacets(), qh_printpoints_out(), qh_printvneighbors(), qh_printvoronoi(), and qh_printvridge(). |
|
Definition at line 861 of file qhull.h. Referenced by qh_check_bestdist(), qh_check_maxout(), qh_matchnewfacets(), and qh_printhashtable(). |
|
|
Definition at line 879 of file qhull.h. Referenced by qh_makeridges(), qh_matchnewfacets(), qh_mergecycle_ridges(), qh_neighbor_intersections(), and qh_printhashtable(). |
|
|
Definition at line 894 of file qhull.h. Referenced by qh_detvnorm(), qh_initialvertices(), qh_partitionall(), qh_printextremes(), and qh_printpoints_out(). |
|
|
Definition at line 909 of file qhull.h. Referenced by qh_checkfacet(). |
|
|
Definition at line 924 of file qhull.h. Referenced by qh_createsimplex(), qh_mergesimplex(), qh_printvdiagram2(), qh_printvneighbors(), and qh_printvoronoi(). |
|
Definition at line 719 of file qhull.h. Referenced by qh_all_merges(), qh_buildtracing(), qh_degen_redundant_neighbors(), qh_findfacet_all(), qh_matchneighbor(), qh_mergesimplex(), qh_premerge(), qh_printhashtable(), and qh_printlists(). |
|
|
|
|
Definition at line 148 of file qhull.h. Referenced by qh_addpoint(), qh_check_bestdist(), qh_check_maxout(), qh_checkflipped_all(), qh_eachvoronoi_all(), qh_errprint(), qh_initialhull(), qh_makenewfacets(), qh_matchnewfacets(), qh_partitioncoplanar(), qh_premerge(), qh_printhelp_singular(), qh_printvdiagram2(), qh_produce_output(), and qh_qhull(). |
|
Definition at line 158 of file qhull.h. Referenced by qh_checkflags(), qh_detroundoff(), qh_initbuild(), qh_initflags(), qh_initqhull_globals(), qh_maxmin(), qh_maxsimplex(), qh_mergefacet(), qh_newvertex(), qh_printafacet(), qh_printvdiagram(), qh_readfeasible(), qh_readpoints(), qh_scalelast(), qh_scalepoints(), qh_setfeasible(), and qh_sethalfspace_all(). |
|
Definition at line 161 of file qhull.h. Referenced by qh_copypoints(), qh_initflags(), qh_initqhull_start(), qh_joggleinput(), qh_projectinput(), qh_readfeasible(), qh_readpoints(), qh_setfeasible(), and qh_sethalfspace_all(). |
|
Definition at line 157 of file qhull.h. Referenced by main(). |
|
Definition at line 160 of file qhull.h. Referenced by qh_check_bestdist(), qh_check_points(), qh_checkconvex(), qh_checkflipped_all(), qh_errexit(), qh_findhorizon(), qh_matchneighbor(), qh_maxsimplex(), and qh_precision(). |
|
|
Definition at line 159 of file qhull.h. Referenced by qh_checkconvex(), qh_errexit(), and qh_initialhull(). |
|
Definition at line 258 of file qhull.h. Referenced by qh_mergecycle_all(), and qh_mergefacet(). |
|
Definition at line 149 of file qhull.h. Referenced by qh_addpoint(), qh_check_bestdist(), qh_check_maxout(), qh_partitioncoplanar(), and qh_partitionpoint(). |
|
|
|
|
Typedef Documentation
|
|
|
|
|
|
|
|
|
|
Enumeration Type Documentation
|
Definition at line 111 of file qhull.h. Referenced by qh_clearcenters().
00112 { 00113 qh_ASnone = 0, qh_ASvoronoi, qh_AScentrum 00114 } |
|
Definition at line 129 of file qhull.h. Referenced by qh_appendprint().
00129 {qh_PRINTnone= 0, 00130 qh_PRINTarea, qh_PRINTaverage, /* 'Fa' 'FV' 'Fc' 'FC' */ 00131 qh_PRINTcoplanars, qh_PRINTcentrums, 00132 qh_PRINTfacets, qh_PRINTfacets_xridge, /* 'f' 'FF' 'G' 'FI' 'Fi' 'Fn' */ 00133 qh_PRINTgeom, qh_PRINTids, qh_PRINTinner, qh_PRINTneighbors, 00134 qh_PRINTnormals, qh_PRINTouter, /* 'n' 'Fo' 'i' 'm' 'Fm' 'o' */ 00135 qh_PRINTincidences, qh_PRINTmathematica, qh_PRINTmerges, qh_PRINToff, 00136 qh_PRINToptions, qh_PRINTpointintersect, /* 'FO' 'Fp' 'FP' 'p' 'FQ' 'FS' */ 00137 qh_PRINTpointnearest, qh_PRINTpoints, qh_PRINTqhull, qh_PRINTsize, 00138 qh_PRINTsummary, qh_PRINTtriangles, /* 'Fs' 'Ft' 'Fv' 'FN' 'Fx' */ 00139 qh_PRINTvertices, qh_PRINTvneighbors, qh_PRINTextremes, 00140 qh_PRINTEND} qh_PRINT; |
Function Documentation
|
Definition at line 92 of file qhulldir/io.c. References FORALLfacets, fout, facetT::id, qh, and qh_printfacet().
00092 { 00093 facetT *facet; 00094 00095 FORALLfacets { 00096 if (facet->id == id) { 00097 qh_printfacet (qh fout, facet); 00098 break; 00099 } 00100 } 00101 } /* dfacet */ |
|
Definition at line 110 of file qhulldir/io.c. References FORALLvertices, fout, vertexT::id, qh, and qh_printvertex().
00110 { 00111 vertexT *vertex; 00112 00113 FORALLvertices { 00114 if (vertex->id == id) { 00115 qh_printvertex (qh fout, vertex); 00116 break; 00117 } 00118 } 00119 } /* dvertex */ |
|
Definition at line 157 of file qhull.c.
00157 { 00158 int goodvisible, goodhorizon; 00159 vertexT *vertex; 00160 facetT *newfacet; 00161 realT dist, newbalance, pbalance; 00162 boolT isoutside= False; 00163 int numpart, numpoints, numnew, firstnew; 00164 00165 qh maxoutdone= False; 00166 if (qh_pointid (furthest) == -1) 00167 qh_setappend (&qh other_points, furthest); 00168 if (!facet) { 00169 fprintf (qh ferr, "qh_addpoint: NULL facet. Use qh_findbestfacet\n"); 00170 qh_errexit (qh_ERRqhull, NULL, NULL); 00171 } 00172 if (checkdist) { 00173 facet= qh_findbest (furthest, facet, !qh_ALL, False, !qh_NOupper, 00174 &dist, &isoutside, &numpart); 00175 zzadd_(Zpartition, numpart); 00176 if (!isoutside) { 00177 zinc_(Znotmax); /* last point of outsideset is no longer furthest. */ 00178 facet->notfurthest= True; 00179 qh_partitioncoplanar (furthest, facet, &dist); 00180 return True; 00181 } 00182 } 00183 qh_buildtracing (furthest, facet); 00184 if (qh STOPpoint < 0 && qh furthest_id == -qh STOPpoint-1) { 00185 facet->notfurthest= True; 00186 return False; 00187 } 00188 qh_findhorizon (furthest, facet, &goodvisible, &goodhorizon); 00189 if (qh ONLYgood && !(goodvisible+goodhorizon) && !qh GOODclosest) { 00190 zinc_(Znotgood); 00191 facet->notfurthest= True; 00192 /* last point of outsideset is no longer furthest. This is ok 00193 since all points of the outside are likely to be bad */ 00194 qh_resetlists (False /*qh visible_list newvertex_list newfacet_list */); 00195 return True; 00196 } 00197 zzinc_(Zprocessed); 00198 firstnew= qh facet_id; 00199 vertex= qh_makenewfacets (furthest /*visible_list, attaches if !ONLYgood */); 00200 qh_makenewplanes (/* newfacet_list */); 00201 numnew= qh facet_id - firstnew; 00202 newbalance= numnew - (realT) (qh num_facets-qh num_visible) 00203 * qh hull_dim/qh num_vertices; 00204 wadd_(Wnewbalance, newbalance); 00205 wadd_(Wnewbalance2, newbalance * newbalance); 00206 if (qh ONLYgood 00207 && !qh_findgood (qh newfacet_list, goodhorizon) && !qh GOODclosest) { 00208 FORALLnew_facets 00209 qh_delfacet (newfacet); 00210 qh_delvertex (vertex); 00211 qh_resetlists (True /*qh visible_list newvertex_list newfacet_list */); 00212 zinc_(Znotgoodnew); 00213 facet->notfurthest= True; 00214 return True; 00215 } 00216 if (qh ONLYgood) 00217 qh_attachnewfacets(/*visible_list*/); 00218 qh_matchnewfacets(); 00219 qh_updatevertices(); 00220 if (qh STOPcone && qh furthest_id == qh STOPcone-1) { 00221 facet->notfurthest= True; 00222 return False; /* visible_list etc. still defined */ 00223 } 00224 if (qh PREmerge || qh MERGEexact) { 00225 qh_premerge (vertex, qh premerge_centrum, qh premerge_cos); 00226 if (zzval_(Ztotmerge) > qh_USEfindbestnew) 00227 qh findbestnew= True; 00228 else { 00229 FORALLnew_facets { 00230 if (!newfacet->simplicial) { 00231 qh findbestnew= True; /* use qh_findbestnew instead of qh_findbest*/ 00232 break; 00233 } 00234 } 00235 } 00236 }else if (qh BESToutside) 00237 qh findbestnew= True; 00238 qh_partitionvisible (/*visible_list, newfacet_list*/ !qh_ALL, &numpoints); 00239 qh findbestnew= False; 00240 qh findbest_notsharp= False; 00241 zinc_(Zpbalance); 00242 pbalance= numpoints - (realT) qh hull_dim /* assumes all points extreme */ 00243 * (qh num_points - qh num_vertices)/qh num_vertices; 00244 wadd_(Wpbalance, pbalance); 00245 wadd_(Wpbalance2, pbalance * pbalance); 00246 qh_deletevisible (/*qh visible_list*/); 00247 zmax_(Zmaxvertex, qh num_vertices); 00248 qh NEWfacets= False; 00249 if (qh IStracing >= 4) 00250 qh_printfacetlist (qh newfacet_list, NULL, True); 00251 if (qh CHECKfrequently) { 00252 if (qh num_facets < 50) 00253 qh_checkpolygon (qh facet_list); 00254 else 00255 qh_checkpolygon (qh newfacet_list); 00256 } 00257 if (qh STOPpoint > 0 && qh furthest_id == qh STOPpoint-1) 00258 return False; 00259 qh_resetlists (True /*qh visible_list newvertex_list newfacet_list */); 00260 trace2((qh ferr, "qh_addpoint: added p%d new facets %d new balance %2.2g point balance %2.2g\n", 00261 qh_pointid (furthest), numnew, newbalance, pbalance)); 00262 if (qh hull_dim > 3 && qh TRACEpoint == qh_pointid (furthest)) { 00263 qh IStracing= 0; 00264 qhmem.IStracing= 0; 00265 } 00266 return True; 00267 } /* addpoint */ |
|
Definition at line 237 of file poly2.c. References i, MERGING, qh, qh_ALGORITHMfault, qh_checkconvex(), qh_checkflipped_all(), qh_checkpolygon(), qh_newstats(), and qhstat.
00237 { 00238 int i; 00239 00240 if (qh STOPcone) 00241 return; 00242 if (qh VERIFYoutput | qh IStracing | qh CHECKfrequently) { 00243 qh_checkpolygon (qh facet_list); 00244 qh_checkflipped_all (qh facet_list); 00245 qh_checkconvex (qh facet_list, qh_ALGORITHMfault); 00246 }else if (!qh MERGING && qh_newstats (qhstat precision, &i)) { 00247 qh_checkflipped_all (qh facet_list); 00248 qh_checkconvex (qh facet_list, qh_ALGORITHMfault); 00249 } 00250 } /* check_output */ |
|
Definition at line 297 of file poly2.c. References boolT, facetT::flipped, FORALLfacets, FORALLpoints, FOREACHpoint_, facetT::good, facetT::maxoutside, MERGING, num_points, pointT, qh, qh_check_bestdist(), qh_check_point(), qh_errexit2(), qh_ERRprec, qh_maxouter(), qh_MAXoutside, qh_QUICKhelp, qh_VERIFYdirect, REALmax, realT, trace0, and trace1.
00297 { 00298 facetT *facet, *errfacet1= NULL, *errfacet2= NULL; 00299 realT total, maxoutside, maxdist= -REALmax; 00300 pointT *point, **pointp, *pointtemp; 00301 boolT testouter; 00302 00303 maxoutside= qh_maxouter(); 00304 maxoutside += qh DISTround; 00305 /* one more qh.DISTround for check computation */ 00306 trace1((qh ferr, "qh_check_points: check all points below %2.2g of all facet planes\n", 00307 maxoutside)); 00308 if (qh num_good) /* miss counts other_points and !good facets */ 00309 total= (float) qh num_good * qh num_points; 00310 else 00311 total= (float) qh num_facets * qh num_points; 00312 if (total >= qh_VERIFYdirect && !qh maxoutdone) { 00313 if (!qh_QUICKhelp && qh SKIPcheckmax && qh MERGING) 00314 fprintf (qh ferr, "\n\ 00315 qhull input warning: merging without checking outer planes ('Q5').\n\ 00316 Verify may report that a point is outside of a facet.\n"); 00317 qh_check_bestdist(); 00318 }else { 00319 if (qh_MAXoutside && qh maxoutdone) 00320 testouter= True; 00321 else 00322 testouter= False; 00323 if (!qh_QUICKhelp) { 00324 if (qh MERGEexact) 00325 fprintf (qh ferr, "\n\ 00326 qhull input warning: exact merge ('Qx'). Verify may report that a point\n\ 00327 is outside of a facet. See qh-optq.htm#Qx\n"); 00328 else if (qh SKIPcheckmax || qh NOnearinside) 00329 fprintf (qh ferr, "\n\ 00330 qhull input warning: no outer plane check ('Q5') or no processing of\n\ 00331 near-inside points ('Q8'). Verify may report that a point is outside\n\ 00332 of a facet.\n"); 00333 } 00334 if (qh PRINTprecision) { 00335 if (testouter) 00336 fprintf (qh ferr, "\n\ 00337 Output completed. Verifying that all points are below outer planes of\n\ 00338 all %sfacets. Will make %2.0f distance computations.\n", 00339 (qh ONLYgood ? "good " : ""), total); 00340 else 00341 fprintf (qh ferr, "\n\ 00342 Output completed. Verifying that all points are below %2.2g of\n\ 00343 all %sfacets. Will make %2.0f distance computations.\n", 00344 maxoutside, (qh ONLYgood ? "good " : ""), total); 00345 } 00346 FORALLfacets { 00347 if (!facet->good && qh ONLYgood) 00348 continue; 00349 if (facet->flipped) 00350 continue; 00351 if (testouter) { 00352 #if qh_MAXoutside 00353 maxoutside= facet->maxoutside + 2* qh DISTround; 00354 /* one DISTround to actual point and another to computed point */ 00355 #endif 00356 } 00357 FORALLpoints { 00358 if (point != qh GOODpointp) 00359 qh_check_point (point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2); 00360 } 00361 FOREACHpoint_(qh other_points) { 00362 if (point != qh GOODpointp) 00363 qh_check_point (point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2); 00364 } 00365 } 00366 if (maxdist > qh outside_err) { 00367 fprintf( qh ferr, "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", 00368 maxdist, qh outside_err ); 00369 qh_errexit2( qh_ERRprec, errfacet1, errfacet2 ); 00370 }else if (errfacet1 && qh outside_err > REALmax/2) 00371 qh_errexit2( qh_ERRprec, errfacet1, errfacet2 ); 00372 else if (errfacet1) 00373 ; /* the error was logged to qh.ferr but does not effect the output */ 00374 trace0((qh ferr, "qh_check_points: max distance outside %2.2g\n", maxdist)); 00375 } 00376 } /* check_points */ |
|
Definition at line 61 of file global.c. References key, qh, qh_errexit(), qh_ERRinput, and qh_strtod().
00061 { 00062 char *s= command, *t, *chkerr, key, opt, prevopt; 00063 char chkkey[]= " "; 00064 char chkopt[]= " "; 00065 char chkopt2[]= " "; 00066 00067 if (*hiddenflags != ' ' || hiddenflags[strlen(hiddenflags)-1] != ' ') { 00068 fprintf(qh ferr, "qhull error (qh_checkflags): hiddenflags must start and end with a space: \"%s\"", hiddenflags); 00069 qh_errexit(qh_ERRinput, NULL, NULL); 00070 } 00071 if (strpbrk(hiddenflags, ",\n\r\t")) { 00072 fprintf(qh ferr, "qhull error (qh_checkflags): hiddenflags contains commas, newlines, or tabs: \"%s\"", hiddenflags); 00073 qh_errexit(qh_ERRinput, NULL, NULL); 00074 } 00075 while (*s && !isspace(*s)) /* skip program name */ 00076 s++; 00077 while (*s) { 00078 while (*s && isspace(*s)) 00079 s++; 00080 if (*s == '-') 00081 s++; 00082 if (!*s) 00083 break; 00084 key = *s++; 00085 chkerr = NULL; 00086 if (key == '\'') { /* TO 'file name' */ 00087 t= strchr(s, '\''); 00088 if (!t) { 00089 fprintf(qh ferr, "qhull error (qh_checkflags): missing the 2nd single-quote for:\n%s\n", s-1); 00090 qh_errexit(qh_ERRinput, NULL, NULL); 00091 } 00092 s= t+1; 00093 continue; 00094 } 00095 chkkey[1]= key; 00096 if (strstr(hiddenflags, chkkey)) { 00097 chkerr= chkkey; 00098 }else if (isupper(key)) { 00099 opt= ' '; 00100 prevopt= ' '; 00101 chkopt[1]= key; 00102 chkopt2[1]= key; 00103 while (!chkerr && *s && !isspace(*s)) { 00104 opt= *s++; 00105 if (isalpha(opt)) { 00106 chkopt[2]= opt; 00107 if (strstr(hiddenflags, chkopt)) 00108 chkerr= chkopt; 00109 if (prevopt != ' ') { 00110 chkopt2[2]= prevopt; 00111 chkopt2[3]= opt; 00112 if (strstr(hiddenflags, chkopt2)) 00113 chkerr= chkopt2; 00114 } 00115 }else if (key == 'Q' && isdigit(opt) && prevopt != 'b' 00116 && (prevopt == ' ' || islower(prevopt))) { 00117 chkopt[2]= opt; 00118 if (strstr(hiddenflags, chkopt)) 00119 chkerr= chkopt; 00120 }else { 00121 qh_strtod (s-1, &t); 00122 if (s < t) 00123 s= t; 00124 } 00125 prevopt= opt; 00126 } 00127 } 00128 if (chkerr) { 00129 *chkerr= '\''; 00130 chkerr[strlen(chkerr)-1]= '\''; 00131 fprintf(qh ferr, "qhull error: option %s is not used with this program.\n It may be used with qhull.\n", chkerr); 00132 qh_errexit(qh_ERRinput, NULL, NULL); 00133 } 00134 } 00135 } /* checkflags */ |
|
Definition at line 148 of file global.c. References qh, qh_errexit(), qh_ERRqhull, and qh_SECticks.
00148 { 00149 00150 #if (qh_CLOCKtype == 2) 00151 struct tms time; 00152 static long clktck; /* initialized first call */ 00153 double ratio, cpu; 00154 unsigned long ticks; 00155 00156 if (!clktck) { 00157 if ((clktck= sysconf (_SC_CLK_TCK)) < 0) { 00158 fprintf (qh ferr, "qhull internal error (qh_clock): sysconf() failed. Use qh_CLOCKtype 1 in user.h\n"); 00159 qh_errexit (qh_ERRqhull, NULL, NULL); 00160 } 00161 } 00162 if (times (&time) == -1) { 00163 fprintf (qh ferr, "qhull internal error (qh_clock): times() failed. Use qh_CLOCKtype 1 in user.h\n"); 00164 qh_errexit (qh_ERRqhull, NULL, NULL); 00165 } 00166 ratio= qh_SECticks / (double)clktck; 00167 ticks= time.tms_utime * ratio; 00168 return ticks; 00169 #else 00170 fprintf (qh ferr, "qhull internal error (qh_clock): use qh_CLOCKtype 2 in user.h\n"); 00171 qh_errexit (qh_ERRqhull, NULL, NULL); /* never returns */ 00172 return 0; 00173 #endif 00174 } /* clock */ |
|
Definition at line 280 of file stat.c. Referenced by qh_errexit(), qh_printallstatistics(), and qh_produce_output().
00280 { 00281 facetT *facet, *neighbor, **neighborp; 00282 vertexT *vertex, **vertexp; 00283 realT dotproduct, dist; 00284 int sizneighbors, sizridges, sizvertices, i; 00285 00286 qh old_randomdist= qh RANDOMdist; 00287 qh RANDOMdist= False; 00288 zval_(Zmempoints)= qh num_points * qh normal_size + 00289 sizeof (qhT) + sizeof (qhstatT); 00290 zval_(Zmemfacets)= 0; 00291 zval_(Zmemridges)= 0; 00292 zval_(Zmemvertices)= 0; 00293 zval_(Zangle)= 0; 00294 wval_(Wangle)= 0.0; 00295 zval_(Znumridges)= 0; 00296 zval_(Znumfacets)= 0; 00297 zval_(Znumneighbors)= 0; 00298 zval_(Znumvertices)= 0; 00299 zval_(Znumvneighbors)= 0; 00300 zval_(Znummergetot)= 0; 00301 zval_(Znummergemax)= 0; 00302 zval_(Zvertices)= qh num_vertices - qh_setsize (qh del_vertices); 00303 if (qh MERGING || qh APPROXhull || qh JOGGLEmax < REALmax/2) 00304 wmax_(Wmaxoutside, qh max_outside); 00305 if (qh MERGING) 00306 wmin_(Wminvertex, qh min_vertex); 00307 FORALLfacets 00308 facet->seen= False; 00309 if (qh DELAUNAY) { 00310 FORALLfacets { 00311 if (facet->upperdelaunay != qh UPPERdelaunay) 00312 facet->seen= True; /* remove from angle statistics */ 00313 } 00314 } 00315 FORALLfacets { 00316 if (facet->visible && qh NEWfacets) 00317 continue; 00318 sizvertices= qh_setsize (facet->vertices); 00319 sizneighbors= qh_setsize (facet->neighbors); 00320 sizridges= qh_setsize (facet->ridges); 00321 zinc_(Znumfacets); 00322 zadd_(Znumvertices, sizvertices); 00323 zmax_(Zmaxvertices, sizvertices); 00324 zadd_(Znumneighbors, sizneighbors); 00325 zmax_(Zmaxneighbors, sizneighbors); 00326 zadd_(Znummergetot, facet->nummerge); 00327 i= facet->nummerge; /* avoid warnings */ 00328 zmax_(Znummergemax, i); 00329 if (!facet->simplicial) { 00330 if (sizvertices == qh hull_dim) { 00331 zinc_(Znowsimplicial); 00332 }else { 00333 zinc_(Znonsimplicial); 00334 } 00335 } 00336 if (sizridges) { 00337 zadd_(Znumridges, sizridges); 00338 zmax_(Zmaxridges, sizridges); 00339 } 00340 zadd_(Zmemfacets, sizeof (facetT) + qh normal_size + 2*sizeof (setT) 00341 + SETelemsize * (sizneighbors + sizvertices)); 00342 if (facet->ridges) { 00343 zadd_(Zmemridges, 00344 sizeof (setT) + SETelemsize * sizridges + sizridges * 00345 (sizeof (ridgeT) + sizeof (setT) + SETelemsize * (qh hull_dim-1))/2); 00346 } 00347 if (facet->outsideset) 00348 zadd_(Zmempoints, sizeof (setT) + SETelemsize * qh_setsize (facet->outsideset)); 00349 if (facet->coplanarset) 00350 zadd_(Zmempoints, sizeof (setT) + SETelemsize * qh_setsize (facet->coplanarset)); 00351 if (facet->seen) /* Delaunay upper envelope */ 00352 continue; 00353 facet->seen= True; 00354 FOREACHneighbor_(facet) { 00355 if (neighbor == qh_DUPLICATEridge || neighbor == qh_MERGEridge 00356 || neighbor->seen || !facet->normal || !neighbor->normal) 00357 continue; 00358 dotproduct= qh_getangle(facet->normal, neighbor->normal); 00359 zinc_(Zangle); 00360 wadd_(Wangle, dotproduct); 00361 wmax_(Wanglemax, dotproduct) 00362 wmin_(Wanglemin, dotproduct) 00363 } 00364 if (facet->normal) { 00365 FOREACHvertex_(facet->vertices) { 00366 zinc_(Zdiststat); 00367 qh_distplane(vertex->point, facet, &dist); 00368 wmax_(Wvertexmax, dist); 00369 wmin_(Wvertexmin, dist); 00370 } 00371 } 00372 } 00373 FORALLvertices { 00374 if (vertex->deleted) 00375 continue; 00376 zadd_(Zmemvertices, sizeof (vertexT)); 00377 if (vertex->neighbors) { 00378 sizneighbors= qh_setsize (vertex->neighbors); 00379 zadd_(Znumvneighbors, sizneighbors); 00380 zmax_(Zmaxvneighbors, sizneighbors); 00381 zadd_(Zmemvertices, sizeof (vertexT) + SETelemsize * sizneighbors); 00382 } 00383 } 00384 qh RANDOMdist= qh old_randomdist; 00385 } /* collectstatistics */ |
|
Definition at line 192 of file user.c.
00192 { 00193 00194 if (qh ERREXITcalled) { 00195 fprintf (qh ferr, "\nqhull error while processing previous error. Exit program\n"); 00196 exit(1); 00197 } 00198 qh ERREXITcalled= True; 00199 if (!qh QHULLfinished) 00200 qh hulltime= qh_CPUclock - qh hulltime; 00201 qh_errprint("ERRONEOUS", facet, NULL, ridge, NULL); 00202 fprintf (qh ferr, "\nWhile executing: %s | %s\n", qh rbox_command, qh qhull_command); 00203 fprintf(qh ferr, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options); 00204 if (qh furthest_id >= 0) { 00205 fprintf(qh ferr, "Last point added to hull was p%d.", qh furthest_id); 00206 if (zzval_(Ztotmerge)) 00207 fprintf(qh ferr, " Last merge was #%d.", zzval_(Ztotmerge)); 00208 if (qh QHULLfinished) 00209 fprintf(qh ferr, "\nQhull has finished constructing the hull."); 00210 else if (qh POSTmerging) 00211 fprintf(qh ferr, "\nQhull has started post-merging."); 00212 fprintf (qh ferr, "\n"); 00213 } 00214 if (qh FORCEoutput && (qh QHULLfinished || (!facet && !ridge))) 00215 qh_produce_output(); 00216 else { 00217 if (exitcode != qh_ERRsingular && zzval_(Zsetplane) > qh hull_dim+1) { 00218 fprintf (qh ferr, "\nAt error exit:\n"); 00219 qh_printsummary (qh ferr); 00220 if (qh PRINTstatistics) { 00221 qh_collectstatistics(); 00222 qh_printstatistics(qh ferr, "at error exit"); 00223 qh_memstatistics (qh ferr); 00224 } 00225 } 00226 if (qh PRINTprecision) 00227 qh_printstats (qh ferr, qhstat precision, NULL); 00228 } 00229 if (!exitcode) 00230 exitcode= qh_ERRqhull; 00231 else if (exitcode == qh_ERRsingular) 00232 qh_printhelp_singular(qh ferr); 00233 else if (exitcode == qh_ERRprec && !qh PREmerge) 00234 qh_printhelp_degenerate (qh ferr); 00235 if (qh NOerrexit) { 00236 fprintf (qh ferr, "qhull error while ending program. Exit program\n"); 00237 exit(1); 00238 } 00239 qh NOerrexit= True; 00240 longjmp(qh errexit, exitcode); 00241 } /* errexit */ |
|
Definition at line 254 of file user.c. References ridgeT::bottom, fout, i, otherfacet_, qh, qh_ALL, qh_PRINTEND, qh_printfacet(), qh_printneighborhood(), qh_printridge(), qh_printvertex(), and ridgeT::top. Referenced by qh_buildhull(), qh_checkfacet(), qh_checkflipped_all(), qh_checkvertex(), qh_errexit(), qh_errexit2(), qh_findhorizon(), qh_matchduplicates(), qh_mergecycle(), qh_mergefacet(), qh_mergevertex_neighbors(), qh_partitioncoplanar(), qh_rename_sharedvertex(), qh_setfacetplane(), and qh_tracemerge().
00254 { 00255 int i; 00256 00257 if (atfacet) { 00258 fprintf(qh ferr, "%s FACET:\n", string); 00259 qh_printfacet(qh ferr, atfacet); 00260 } 00261 if (otherfacet) { 00262 fprintf(qh ferr, "%s OTHER FACET:\n", string); 00263 qh_printfacet(qh ferr, otherfacet); 00264 } 00265 if (atridge) { 00266 fprintf(qh ferr, "%s RIDGE:\n", string); 00267 qh_printridge(qh ferr, atridge); 00268 if (atridge->top && atridge->top != atfacet && atridge->top != otherfacet) 00269 qh_printfacet(qh ferr, atridge->top); 00270 if (atridge->bottom 00271 && atridge->bottom != atfacet && atridge->bottom != otherfacet) 00272 qh_printfacet(qh ferr, atridge->bottom); 00273 if (!atfacet) 00274 atfacet= atridge->top; 00275 if (!otherfacet) 00276 otherfacet= otherfacet_(atridge, atfacet); 00277 } 00278 if (atvertex) { 00279 fprintf(qh ferr, "%s VERTEX:\n", string); 00280 qh_printvertex (qh ferr, atvertex); 00281 } 00282 if (qh fout && qh FORCEoutput && atfacet && !qh QHULLfinished && !qh IStracing) { 00283 fprintf(qh ferr, "ERRONEOUS and NEIGHBORING FACETS to output\n"); 00284 for (i= 0; i < qh_PRINTEND; i++) /* use fout for geomview output */ 00285 qh_printneighborhood (qh fout, qh PRINTout[i], atfacet, otherfacet, 00286 !qh_ALL); 00287 } 00288 } /* errprint */ |
|
Definition at line 747 of file qhulldir/io.c. References boolT, FORALLfacet_, FORALLvertices, FOREACHfacet_, FOREACHvertex_, qh, qh_setappend(), qh_settemp(), qh_skipfacet(), facetT::vertices, and vertexT::visitid. Referenced by qh_printbegin(), qh_printextremes(), qh_printextremes_2d(), qh_printextremes_d(), qh_printfacets(), qh_printpoints_out(), qh_printvertexlist(), and qh_printvneighbors().
00747 { 00748 setT *vertices; 00749 facetT *facet, **facetp; 00750 vertexT *vertex, **vertexp; 00751 00752 qh vertex_visit++; 00753 if (facetlist == qh facet_list && allfacets && !facets) { 00754 vertices= qh_settemp (qh num_vertices); 00755 FORALLvertices { 00756 vertex->visitid= qh vertex_visit; 00757 qh_setappend (&vertices, vertex); 00758 } 00759 }else { 00760 vertices= qh_settemp (qh TEMPsize); 00761 FORALLfacet_(facetlist) { 00762 if (!allfacets && qh_skipfacet (facet)) 00763 continue; 00764 FOREACHvertex_(facet->vertices) { 00765 if (vertex->visitid != qh vertex_visit) { 00766 vertex->visitid= qh vertex_visit; 00767 qh_setappend (&vertices, vertex); 00768 } 00769 } 00770 } 00771 } 00772 FOREACHfacet_(facets) { 00773 if (!allfacets && qh_skipfacet (facet)) 00774 continue; 00775 FOREACHvertex_(facet->vertices) { 00776 if (vertex->visitid != qh vertex_visit) { 00777 vertex->visitid= qh vertex_visit; 00778 qh_setappend (&vertices, vertex); 00779 } 00780 } 00781 } 00782 return vertices; 00783 } /* facetvertices */ |
|
Definition at line 227 of file geom.c. References boolT, facetT::flipped, fmax_, FOREACHneighbor_, facetT::good, facetT::id, facetT::maxoutside, MERGING, minimize_, facetT::neighbors, facetT::newfacet, pointT, qh, qh_distplane(), qh_errexit(), qh_ERRqhull, qh_findbestsharp(), qh_MAXoutside, qh_pointid(), qh_setappend(), qh_setdellast(), qh_settruncate(), REALmax, realT, SETfirst_, SETfirstt_, trace4, facetT::upperdelaunay, facetT::visitid, Ztotmerge, and zzval_. Referenced by qh_addpoint(), qh_check_bestdist(), qh_check_maxout(), qh_findbestfacet(), qh_partitioncoplanar(), and qh_partitionpoint().
00229 { 00230 realT bestdist= -REALmax/2 /* avoid underflow */, searchdist; 00231 realT cutoff, mincutoff; /* skip facets that are too far from point */ 00232 facetT *facet, *neighbor, **neighborp, *bestfacet= NULL; 00233 int oldtrace= qh IStracing; 00234 int searchsize= 0; /* non-zero if searchset defined */ 00235 boolT newbest; 00236 boolT ischeckmax= bestoutside && !newfacets && !isoutside; 00237 boolT ispartition= newfacets && isoutside; 00238 boolT isfindfacet= !newfacets && isoutside; 00239 boolT testhorizon = ispartition && (bestoutside || qh APPROXhull || qh MERGING); 00240 00241 if (!ischeckmax && !ispartition && !isfindfacet) { 00242 fprintf (qh ferr, "qhull internal error (qh_findbest): unknown combination of arguments\n"); 00243 qh_errexit (qh_ERRqhull, startfacet, NULL); 00244 } 00245 if (qh TRACElevel && qh TRACEpoint >= 0 && qh TRACEpoint == qh_pointid (point)) { 00246 qh IStracing= qh TRACElevel; 00247 fprintf (qh ferr, "qh_findbest: point p%d starting at f%d bestoutside? %d newfacets %d\n", 00248 qh TRACEpoint, startfacet->id, bestoutside, newfacets); 00249 fprintf(qh ferr, " ischeckmax %d ispartition %d isfindfacet %d testhorizon %d\n", 00250 ischeckmax, ispartition, isfindfacet, testhorizon); 00251 fprintf (qh ferr, " Last point added to hull was p%d.", qh furthest_id); 00252 fprintf(qh ferr, " Last merge was #%d.\n", zzval_(Ztotmerge)); 00253 } 00254 if (isoutside) 00255 *isoutside= True; 00256 00257 if (!startfacet->flipped) { 00258 *numpart= 1; 00259 qh_distplane (point, startfacet, dist); /* this code is duplicated below */ 00260 if (!startfacet->upperdelaunay || (!noupper && *dist >= qh MINoutside)) { 00261 bestdist= *dist; 00262 bestfacet= startfacet; 00263 if (!bestoutside && *dist >= qh MINoutside) 00264 goto LABELreturn_best; 00265 } 00266 #if qh_MAXoutside 00267 if (ischeckmax && (!qh ONLYgood || startfacet->good) && *dist > startfacet->maxoutside) 00268 startfacet->maxoutside= *dist; 00269 #endif 00270 } 00271 if (ispartition) 00272 searchdist= 2 * qh DISTround; 00273 else 00274 searchdist= qh max_outside + 2 * qh DISTround 00275 + fmax_( qh MINvisible, qh MAXcoplanar); 00276 cutoff= bestdist - searchdist; 00277 mincutoff= 0; 00278 if (ischeckmax) { 00279 mincutoff= -(qh DISTround - fmax_(qh MINvisible, qh MAXcoplanar)); 00280 minimize_(cutoff, mincutoff); 00281 } 00282 startfacet->visitid= ++qh visit_id; 00283 facet= startfacet; 00284 do { /* search neighbors of coplanar, upperdelaunay, and flipped facets */ 00285 if (True) { 00286 LABELrestart: /* directed search whenever improvement > searchdist */ 00287 newbest= False; 00288 trace4((qh ferr, "qh_findbest: neighbors of f%d, bestdist %2.2g cutoff %2.2g searchdist %2.2g\n", 00289 facet->id, bestdist, cutoff, searchdist)); 00290 FOREACHneighbor_(facet) { 00291 if (ispartition && !neighbor->newfacet) 00292 continue; 00293 if (!neighbor->flipped) { 00294 if (neighbor->visitid == qh visit_id) 00295 continue; 00296 neighbor->visitid= qh visit_id; 00297 (*numpart)++; 00298 qh_distplane (point, neighbor, dist); 00299 if (!bestoutside && *dist >= qh MINoutside 00300 && (!noupper || !facet->upperdelaunay)) { 00301 bestfacet= neighbor; 00302 goto LABELreturn_best; 00303 } 00304 #if qh_MAXoutside 00305 if (ischeckmax) { 00306 if ((!qh ONLYgood || neighbor->good) 00307 && *dist > neighbor->maxoutside) 00308 neighbor->maxoutside= *dist; 00309 else if (bestfacet && *dist < cutoff) 00310 continue; 00311 }else 00312 #endif /* dangling else! */ 00313 if (bestfacet && *dist < cutoff) 00314 continue; 00315 if (*dist > bestdist) { 00316 if (!neighbor->upperdelaunay 00317 || (bestoutside && !noupper && *dist >= qh MINoutside)) { 00318 if (ischeckmax && qh_MAXoutside) { 00319 bestdist= *dist; 00320 bestfacet= neighbor; 00321 cutoff= bestdist - searchdist; 00322 minimize_(cutoff, mincutoff); 00323 }else if (*dist > bestdist + searchdist) { 00324 bestdist= *dist; 00325 bestfacet= neighbor; 00326 cutoff= bestdist - searchdist; 00327 searchsize= 0; 00328 facet= neighbor; 00329 if (newbest) /* newbest may be coplanar with facet */ 00330 facet->visitid= ++qh visit_id; 00331 goto LABELrestart; /* repeat with a new facet */ 00332 }else { 00333 bestdist= *dist; 00334 bestfacet= neighbor; 00335 cutoff= bestdist - searchdist; 00336 } 00337 newbest= True; 00338 } 00339 } 00340 } 00341 if (!searchsize++) { 00342 SETfirst_(qh searchset) = neighbor; 00343 qh_settruncate (qh searchset, 1); 00344 }else 00345 qh_setappend (&qh searchset, neighbor); 00346 } /* FOREACHneighbor */ 00347 } /* while (restart) */ 00348 }while 00349 (searchsize && (facet= (facetT*)qh_setdellast (qh searchset))); 00350 if (!ischeckmax) { 00351 if (!bestfacet) { 00352 fprintf (qh ferr, "qh_findbest: point p%d starting at f%d bestoutside? %d newfacets %d\n", 00353 qh TRACEpoint, startfacet->id, bestoutside, newfacets); 00354 fprintf(qh ferr, "\n\ 00355 qh_findbest: all neighbors of facet %d are flipped or upper Delaunay.\n\ 00356 Please report this error to qhull_bug@geom.umn.edu with the input and all of the output.\n", 00357 startfacet->id); 00358 qh FORCEoutput= True; 00359 qh_errexit (qh_ERRqhull, startfacet, NULL); 00360 } 00361 if (ispartition && !qh findbest_notsharp && bestdist < - qh DISTround) { 00362 if (qh_findbestsharp ( point, &bestfacet, &bestdist, numpart)) 00363 qh findbestnew= True; 00364 else 00365 qh findbest_notsharp= True; 00366 } 00367 if (testhorizon) { 00368 facet= SETfirstt_(bestfacet->neighbors, facetT); 00369 trace4((qh ferr, "qh_findbest: horizon facet f%d\n", facet->id)); 00370 (*numpart)++; 00371 qh_distplane (point, facet, dist); 00372 if (*dist > bestdist 00373 && (!facet->upperdelaunay || (!noupper && *dist >= qh MINoutside))) { 00374 bestdist= *dist; 00375 bestfacet= facet; 00376 } 00377 } 00378 } 00379 *dist= bestdist; 00380 if (isoutside && bestdist < qh MINoutside) 00381 *isoutside= False; 00382 LABELreturn_best: 00383 qh IStracing= oldtrace; 00384 return bestfacet; 00385 } /* findbest */ |
|
Definition at line 1151 of file poly2.c. References boolT, facetT::id, pointT, qh, qh_errexit(), qh_ERRqhull, qh_findbest(), qh_findfacet_all(), realT, trace3, and facetT::upperdelaunay.
01152 { 01153 facetT *bestfacet= NULL; 01154 int numpart, totpart= 0; 01155 01156 bestfacet= qh_findbest (point, qh facet_list, 01157 bestoutside, False, bestoutside, 01158 bestdist, isoutside, &totpart); 01159 if (!bestfacet) { 01160 fprintf (qh ferr, "qh_findbestfacet: all facets are flipped or upper Delaunay\n"); 01161 qh_errexit (qh_ERRqhull, NULL, NULL); 01162 } 01163 if (*bestdist < -qh DISTround) { 01164 bestfacet= qh_findfacet_all (point, bestdist, isoutside, &numpart); 01165 totpart += numpart; 01166 if ((isoutside && bestoutside) 01167 || (!isoutside && bestfacet->upperdelaunay)) { 01168 bestfacet= qh_findbest (point, bestfacet, 01169 bestoutside, False, bestoutside, 01170 bestdist, isoutside, &totpart); 01171 totpart += numpart; 01172 } 01173 } 01174 trace3((qh ferr, "qh_findbestfacet: f%d dist %2.2g isoutside %d totpart %d\n", 01175 bestfacet->id, *bestdist, *isoutside, totpart)); 01176 return bestfacet; 01177 } /* findbestfacet */ |
|
Definition at line 423 of file geom.c. References boolT, FORALLfacet_, FOREACHneighbor_, i, facetT::id, MERGING, facetT::newfacet, pointT, qh, qh_DISToutside, qh_distplane(), qh_errexit(), qh_ERRqhull, qh_pointid(), REALmax, realT, facetT::upperdelaunay, Ztotmerge, and zzval_. Referenced by qh_initbuild(), qh_partitioncoplanar(), and qh_partitionpoint().
00424 { 00425 realT bestdist= -REALmax, bestdist2= -REALmax; 00426 facetT *neighbor, **neighborp, *bestfacet= NULL, *newfacet, *facet; 00427 facetT *bestfacet2= NULL; 00428 int oldtrace= qh IStracing, i; 00429 realT distoutside; 00430 00431 if (!startfacet) { 00432 if (qh MERGING) 00433 fprintf(qh ferr, "qhull precision error (qh_findbestnew): merging has formed and deleted an independent cycle of facets. Can not continue.\n"); 00434 else 00435 fprintf(qh ferr, "qhull internal error (qh_findbestnew): no new facets for point p%d\n", 00436 qh furthest_id); 00437 qh_errexit (qh_ERRqhull, NULL, NULL); 00438 } 00439 if (qh BESToutside || !isoutside) 00440 distoutside= REALmax; 00441 else if (qh MERGING) 00442 distoutside= qh_DISToutside; /* defined in user.h */ 00443 else 00444 distoutside= qh MINoutside; 00445 if (qh TRACElevel && qh TRACEpoint >= 0 && qh TRACEpoint == qh_pointid (point)) { 00446 qh IStracing= qh TRACElevel; 00447 fprintf(qh ferr, "qh_findbestnew: point p%d facet f%d. Stop if dist > %2.2g\n", 00448 qh TRACEpoint, startfacet->id, distoutside); 00449 fprintf(qh ferr, " Last point added to hull was p%d.", qh furthest_id); 00450 fprintf(qh ferr, " Last merge was #%d.\n", zzval_(Ztotmerge)); 00451 } 00452 if (isoutside) 00453 *isoutside= True; 00454 *numpart= 0; 00455 00456 /* visit all new facets starting with startfacet */ 00457 for (i= 0, facet= startfacet; i < 2; i++, facet= qh newfacet_list) { 00458 FORALLfacet_(facet) { 00459 if (facet == startfacet && i) 00460 break; 00461 qh_distplane (point, facet, dist); 00462 (*numpart)++; 00463 if (facet->upperdelaunay) { 00464 if (*dist > bestdist2) { 00465 bestdist2= *dist; 00466 bestfacet2= facet; 00467 if (*dist >= distoutside) { 00468 bestfacet= facet; 00469 goto LABELreturn_bestnew; 00470 } 00471 } 00472 }else if (*dist > bestdist) { 00473 bestdist= *dist; 00474 bestfacet= facet; 00475 if (*dist >= distoutside) 00476 goto LABELreturn_bestnew; 00477 } 00478 } 00479 } 00480 newfacet= bestfacet ? bestfacet : bestfacet2; 00481 /* !bestfacet only occurs if 'd' creates incorrect upper-delaunay facets */ 00482 FOREACHneighbor_(newfacet) { 00483 if (!neighbor->newfacet) { 00484 qh_distplane (point, neighbor, dist); 00485 (*numpart)++; 00486 if (neighbor->upperdelaunay) { 00487 if (*dist > bestdist2) { 00488 bestdist2= *dist; 00489 bestfacet2= neighbor; 00490 } 00491 }else if (*dist > bestdist) { 00492 bestdist= *dist; 00493 bestfacet= neighbor; 00494 } 00495 } 00496 } 00497 if (!bestfacet 00498 || (isoutside && bestdist2 >= qh MINoutside && bestdist2 > bestdist)) { 00499 *dist= bestdist2; 00500 bestfacet= bestfacet2; 00501 }else 00502 *dist= bestdist; 00503 if (isoutside && *dist < qh MINoutside) 00504 *isoutside= False; 00505 LABELreturn_bestnew: 00506 qh IStracing= oldtrace; 00507 return bestfacet; 00508 } /* findbestnew */ |
|
Definition at line 185 of file global.c.
00185 { 00186 00187 trace5((qh ferr, "qh_freebuffers: freeing up global memory buffers\n")); 00188 /* allocated by qh_initqhull_buffers */ 00189 qh_memfree (qh NEARzero, qh hull_dim * sizeof(realT)); 00190 qh_memfree (qh lower_threshold, (qh input_dim+1) * sizeof(realT)); 00191 qh_memfree (qh upper_threshold, (qh input_dim+1) * sizeof(realT)); 00192 qh_memfree (qh lower_bound, (qh input_dim+1) * sizeof(realT)); 00193 qh_memfree (qh upper_bound, (qh input_dim+1) * sizeof(realT)); 00194 qh_memfree (qh gm_matrix, (qh hull_dim+1) * qh hull_dim * sizeof(coordT)); 00195 qh_memfree (qh gm_row, (qh hull_dim+1) * sizeof(coordT *)); 00196 qh NEARzero= qh lower_threshold= qh upper_threshold= NULL; 00197 qh lower_bound= qh upper_bound= NULL; 00198 qh gm_matrix= NULL; 00199 qh gm_row= NULL; 00200 qh_setfree (&qh other_points); 00201 qh_setfree (&qh del_vertices); 00202 qh_setfree (&qh searchset); 00203 if (qh line) /* allocated by qh_readinput, freed if no error */ 00204 free (qh line); 00205 if (qh half_space) 00206 free (qh half_space); 00207 if (qh temp_malloc) 00208 free (qh temp_malloc); 00209 if (qh feasible_point) /* allocated by qh_readfeasible */ 00210 free (qh feasible_point); 00211 if (qh feasible_string) /* allocated by qh_initflags */ 00212 free (qh feasible_string); 00213 qh line= qh feasible_string= NULL; 00214 qh half_space= qh feasible_point= qh temp_malloc= NULL; 00215 /* usually allocated by qh_readinput */ 00216 if (qh first_point && qh POINTSmalloc) { 00217 free(qh first_point); 00218 qh first_point= NULL; 00219 } 00220 if (qh input_points && qh input_malloc) { /* set by qh_joggleinput */ 00221 free (qh input_points); 00222 qh input_points= NULL; 00223 } 00224 trace5((qh ferr, "qh_freebuffers: finished\n")); 00225 } /* freebuffers */ |
|
Definition at line 344 of file global.c. References boolT, free, qh, qh_freebuffers(), qh_freebuild(), qh_freestatistics(), and trace1. Referenced by main().
00344 { 00345 00346 trace1((qh ferr, "qh_freeqhull: free global memory\n")); 00347 qh NOerrexit= True; /* no more setjmp since called at exit */ 00348 qh_freebuild (allmem); 00349 qh_freebuffers(); 00350 qh_freestatistics(); 00351 #if qh_QHpointer 00352 free (qh_qh); 00353 qh_qh= NULL; 00354 #else 00355 memset((char *)&qh_qh, 0, sizeof(qhT)); 00356 qh NOerrexit= True; 00357 #endif 00358 } /* freeqhull */ |
|
Definition at line 810 of file geom2.c. References boolT, i, realT, wmin_, and Wmindenom. Referenced by qh_init_B().
00810 { 00811 realT *rowi, *rowj, norm; 00812 int i, j, k; 00813 00814 for(i=0; i < dim; i++) { 00815 rowi= row[i]; 00816 for (norm= 0.0, k= dim; k--; rowi++) 00817 norm += *rowi * *rowi; 00818 norm= sqrt(norm); 00819 wmin_(Wmindenom, norm); 00820 if (norm == 0.0) /* either 0 or overflow due to sqrt */ 00821 return False; 00822 for(k= dim; k--; ) 00823 *(--rowi) /= norm; 00824 for(j= i+1; j < dim; j++) { 00825 rowj= row[j]; 00826 for(norm= 0.0, k=dim; k--; ) 00827 norm += *rowi++ * *rowj++; 00828 for(k=dim; k--; ) 00829 *(--rowj) -= *(--rowi) * norm; 00830 } 00831 } 00832 return True; 00833 } /* gram_schmidt */ |
|
Definition at line 378 of file global.c. References argc, qh_init_qhull_command(), qh_initqhull_start(), and qh_meminit(). Referenced by main().
00378 { 00379 qh_meminit (errfile); 00380 qh_initqhull_start (infile, outfile, errfile); 00381 qh_init_qhull_command (argc, argv); 00382 } /* init_A */ |
|
Definition at line 425 of file global.c. References boolT, coordT, qh, qh_gram_schmidt(), qh_initqhull_buffers(), qh_initqhull_globals(), qh_initqhull_mem(), qh_initthresholds(), qh_projectinput(), qh_randommatrix(), qh_rotateinput(), and qh_scaleinput(). Referenced by main(), and qh_new_qhull().
00425 { 00426 qh_initqhull_globals (points, numpoints, dim, ismalloc); 00427 if (qhmem.LASTsize == 0) 00428 qh_initqhull_mem(); 00429 /* mem.c and qset.c are initialized */ 00430 qh_initqhull_buffers(); 00431 qh_initthresholds (qh qhull_command); 00432 if (qh PROJECTinput || (qh DELAUNAY && qh PROJECTdelaunay)) 00433 qh_projectinput(); 00434 if (qh SCALEinput) 00435 qh_scaleinput(); 00436 if (qh ROTATErandom >= 0) { 00437 qh_randommatrix (qh gm_matrix, qh hull_dim, qh gm_row); 00438 if (qh DELAUNAY) { 00439 int k, lastk= qh hull_dim-1; 00440 for (k= 0; k < lastk; k++) { 00441 qh gm_row[k][lastk]= 0.0; 00442 qh gm_row[lastk][k]= 0.0; 00443 } 00444 qh gm_row[lastk][lastk]= 1.0; 00445 } 00446 qh_gram_schmidt (qh hull_dim, qh gm_row); 00447 qh_rotateinput (qh gm_row); 00448 } 00449 } /* init_B */ |
|
Definition at line 465 of file global.c. Referenced by qh_init_A().
00465 { 00466 int i; 00467 char *s; 00468 00469 if (argc) { 00470 if ((s= strrchr( argv[0], '\\'))) /* Borland gives full path */ 00471 strcpy (qh qhull_command, s+1); 00472 else 00473 strcpy (qh qhull_command, argv[0]); 00474 if ((s= strstr (qh qhull_command, ".EXE")) 00475 || (s= strstr (qh qhull_command, ".exe"))) 00476 *s= '\0'; 00477 } 00478 for (i=1; i < argc; i++) { 00479 if (strlen (qh qhull_command) + strlen(argv[i]) + 1 < sizeof(qh qhull_command)) { 00480 strcat (qh qhull_command, " "); 00481 strcat (qh qhull_command, argv[i]); 00482 }else { 00483 fprintf (qh ferr, "qhull input error: more than %d characters in command line\n", 00484 (int)sizeof(qh qhull_command)); 00485 exit (1); /* can not use qh_errexit */ 00486 } 00487 } 00488 } /* init_qhull_command */ |
|
|
|
Definition at line 521 of file global.c. References boolT, calloc, fout, i, key, MERGING, qh, qh_appendprint(), qh_DEFAULTbox, qh_errexit(), qh_ERRinput, qh_ERRmem, qh_option(), qh_PRINTarea, qh_PRINTaverage, qh_PRINTcentrums, qh_PRINTcoplanars, qh_PRINTextremes, qh_PRINTfacets, qh_PRINTfacets_xridge, qh_PRINTgeom, qh_PRINTids, qh_PRINTincidences, qh_PRINTinner, qh_PRINTmathematica, qh_PRINTmerges, qh_PRINTneighbors, qh_PRINTnormals, qh_PRINToff, qh_PRINToptions, qh_PRINTouter, qh_PRINTpointintersect, qh_PRINTpointnearest, qh_PRINTpoints, qh_PRINTqhull, qh_PRINTsize, qh_PRINTsummary, qh_PRINTtriangles, qh_PRINTvertices, qh_PRINTvneighbors, qh_strtod(), qh_strtol(), r, realT, and trace2. Referenced by main(), and qh_new_qhull().
00521 { 00522 int k, i, lastproject; 00523 char *s= command, *t, *prev_s, *start, key; 00524 boolT isgeom= False, wasproject; 00525 realT r; 00526 00527 if (command != &qh qhull_command[0]) { 00528 *qh qhull_command= '\0'; 00529 strncat( qh qhull_command, command, sizeof( qh qhull_command)); 00530 } 00531 while (*s && !isspace(*s)) /* skip program name */ 00532 s++; 00533 while (*s) { 00534 while (*s && isspace(*s)) 00535 s++; 00536 if (*s == '-') 00537 s++; 00538 if (!*s) 00539 break; 00540 prev_s= s; 00541 switch (*s++) { 00542 case 'd': 00543 qh_option ("delaunay", NULL, NULL); 00544 qh DELAUNAY= True; 00545 break; 00546 case 'f': 00547 qh_option ("facets", NULL, NULL); 00548 qh_appendprint (qh_PRINTfacets); 00549 break; 00550 case 'i': 00551 qh_option ("incidence", NULL, NULL); 00552 qh_appendprint (qh_PRINTincidences); 00553 break; 00554 case 'm': 00555 qh_option ("mathematica", NULL, NULL); 00556 qh_appendprint (qh_PRINTmathematica); 00557 break; 00558 case 'n': 00559 qh_option ("normals", NULL, NULL); 00560 qh_appendprint (qh_PRINTnormals); 00561 break; 00562 case 'o': 00563 qh_option ("offFile", NULL, NULL); 00564 qh_appendprint (qh_PRINToff); 00565 break; 00566 case 'p': 00567 qh_option ("points", NULL, NULL); 00568 qh_appendprint (qh_PRINTpoints); 00569 break; 00570 case 's': 00571 qh_option ("summary", NULL, NULL); 00572 qh PRINTsummary= True; 00573 break; 00574 case 'v': 00575 qh_option ("voronoi", NULL, NULL); 00576 qh VORONOI= True; 00577 qh DELAUNAY= True; 00578 break; 00579 case 'A': 00580 if (!isdigit(*s) && *s != '.' && *s != '-') 00581 fprintf(qh ferr, "qhull warning: no maximum cosine angle given for option 'An'. Ignored.\n"); 00582 else { 00583 if (*s == '-') { 00584 qh premerge_cos= -qh_strtod (s, &s); 00585 qh_option ("Angle-premerge-", NULL, &qh premerge_cos); 00586 qh PREmerge= True; 00587 }else { 00588 qh postmerge_cos= qh_strtod (s, &s); 00589 qh_option ("Angle-postmerge", NULL, &qh postmerge_cos); 00590 qh POSTmerge= True; 00591 } 00592 qh MERGING= True; 00593 } 00594 break; 00595 case 'C': 00596 if (!isdigit(*s) && *s != '.' && *s != '-') 00597 fprintf(qh ferr, "qhull warning: no centrum radius given for option 'Cn'. Ignored.\n"); 00598 else { 00599 if (*s == '-') { 00600 qh premerge_centrum= -qh_strtod (s, &s); 00601 qh_option ("Centrum-premerge-", NULL, &qh premerge_centrum); 00602 qh PREmerge= True; 00603 }else { 00604 qh postmerge_centrum= qh_strtod (s, &s); 00605 qh_option ("Centrum-postmerge", NULL, &qh postmerge_centrum); 00606 qh POSTmerge= True; 00607 } 00608 qh MERGING= True; 00609 } 00610 break; 00611 case 'E': 00612 if (*s == '-') 00613 fprintf(qh ferr, "qhull warning: negative maximum roundoff given for option 'An'. Ignored.\n"); 00614 else if (!isdigit(*s)) 00615 fprintf(qh ferr, "qhull warning: no maximum roundoff given for option 'En'. Ignored.\n"); 00616 else { 00617 qh DISTround= qh_strtod (s, &s); 00618 qh_option ("Distance-roundoff", NULL, &qh DISTround); 00619 qh SETroundoff= True; 00620 } 00621 break; 00622 case 'H': 00623 start= s; 00624 qh HALFspace= True; 00625 qh_strtod (s, &t); 00626 while (t > s) { 00627 if (*t && !isspace (*t)) { 00628 if (*t == ',') 00629 t++; 00630 else 00631 fprintf (qh ferr, "qhull warning: origin for Halfspace intersection should be 'Hn,n,n,...'\n"); 00632 } 00633 s= t; 00634 qh_strtod (s, &t); 00635 } 00636 if (start < t) { 00637 if (!(qh feasible_string= (char*)calloc (t-start+1, 1))) { 00638 fprintf(qh ferr, "qhull error: insufficient memory for 'Hn,n,n'\n"); 00639 qh_errexit(qh_ERRmem, NULL, NULL); 00640 } 00641 strncpy (qh feasible_string, start, t-start); 00642 qh_option ("Halfspace-about", NULL, NULL); 00643 qh_option (qh feasible_string, NULL, NULL); 00644 }else 00645 qh_option ("Halfspace", NULL, NULL); 00646 break; 00647 case 'R': 00648 if (!isdigit(*s)) 00649 fprintf(qh ferr, "qhull warning: missing random perturbation for option 'Rn'. Ignored\n"); 00650 else { 00651 qh RANDOMfactor= qh_strtod (s, &s); 00652 qh_option ("Random_perturb", NULL, &qh RANDOMfactor); 00653 qh RANDOMdist= True; 00654 } 00655 break; 00656 case 'V': 00657 if (!isdigit(*s) && *s != '-') 00658 fprintf(qh ferr, "qhull warning: missing visible distance for option 'Vn'. Ignored\n"); 00659 else { 00660 qh MINvisible= qh_strtod (s, &s); 00661 qh_option ("Visible", NULL, &qh MINvisible); 00662 } 00663 break; 00664 case 'U': 00665 if (!isdigit(*s) && *s != '-') 00666 fprintf(qh ferr, "qhull warning: missing coplanar distance for option 'Un'. Ignored\n"); 00667 else { 00668 qh MAXcoplanar= qh_strtod (s, &s); 00669 qh_option ("U-coplanar", NULL, &qh MAXcoplanar); 00670 } 00671 break; 00672 case 'W': 00673 if (*s == '-') 00674 fprintf(qh ferr, "qhull warning: negative outside width for option 'Wn'. Ignored.\n"); 00675 else if (!isdigit(*s)) 00676 fprintf(qh ferr, "qhull warning: missing outside width for option 'Wn'. Ignored\n"); 00677 else { 00678 qh MINoutside= qh_strtod (s, &s); 00679 qh_option ("W-outside", NULL, &qh MINoutside); 00680 qh APPROXhull= True; 00681 } 00682 break; 00683 /************ sub menus ***************/ 00684 case 'F': 00685 while (*s && !isspace(*s)) { 00686 switch(*s++) { 00687 case 'a': 00688 qh_option ("Farea", NULL, NULL); 00689 qh_appendprint (qh_PRINTarea); 00690 qh GETarea= True; 00691 break; 00692 case 'A': 00693 qh_option ("FArea-total", NULL, NULL); 00694 qh GETarea= True; 00695 break; 00696 case 'c': 00697 qh_option ("Fcoplanars", NULL, NULL); 00698 qh_appendprint (qh_PRINTcoplanars); 00699 break; 00700 case 'C': 00701 qh_option ("FCentrums", NULL, NULL); 00702 qh_appendprint (qh_PRINTcentrums); 00703 break; 00704 case 'd': 00705 qh_option ("Fd-cdd-in", NULL, NULL); 00706 qh CDDinput= True; 00707 break; 00708 case 'D': 00709 qh_option ("FD-cdd-out", NULL, NULL); 00710 qh CDDoutput= True; 00711 break; 00712 case 'F': 00713 qh_option ("FFacets-xridge", NULL, NULL); 00714 qh_appendprint (qh_PRINTfacets_xridge); 00715 break; 00716 case 'i': 00717 qh_option ("Finner", NULL, NULL); 00718 qh_appendprint (qh_PRINTinner); 00719 break; 00720 case 'I': 00721 qh_option ("FIDs", NULL, NULL); 00722 qh_appendprint (qh_PRINTids); 00723 break; 00724 case 'm': 00725 qh_option ("Fmerges", NULL, NULL); 00726 qh_appendprint (qh_PRINTmerges); 00727 break; 00728 case 'n': 00729 qh_option ("Fneighbors", NULL, NULL); 00730 qh_appendprint (qh_PRINTneighbors); 00731 break; 00732 case 'N': 00733 qh_option ("FNeighbors-vertex", NULL, NULL); 00734 qh_appendprint (qh_PRINTvneighbors); 00735 break; 00736 case 'o': 00737 qh_option ("Fouter", NULL, NULL); 00738 qh_appendprint (qh_PRINTouter); 00739 break; 00740 case 'O': 00741 if (qh PRINToptions1st) { 00742 qh_option ("FOptions", NULL, NULL); 00743 qh_appendprint (qh_PRINToptions); 00744 }else 00745 qh PRINToptions1st= True; 00746 break; 00747 case 'p': 00748 qh_option ("Fpoint-intersect", NULL, NULL); 00749 qh_appendprint (qh_PRINTpointintersect); 00750 break; 00751 case 'P': 00752 qh_option ("FPoint-nearest", NULL, NULL); 00753 qh_appendprint (qh_PRINTpointnearest); 00754 break; 00755 case 'Q': 00756 qh_option ("FQhull", NULL, NULL); 00757 qh_appendprint (qh_PRINTqhull); 00758 break; 00759 case 's': 00760 qh_option ("Fsummary", NULL, NULL); 00761 qh_appendprint (qh_PRINTsummary); 00762 break; 00763 case 'S': 00764 qh_option ("FSize", NULL, NULL); 00765 qh_appendprint (qh_PRINTsize); 00766 qh GETarea= True; 00767 break; 00768 case 't': 00769 qh_option ("Ftriangles", NULL, NULL); 00770 qh_appendprint (qh_PRINTtriangles); 00771 break; 00772 case 'v': 00773 /* option set in qh_initqhull_globals */ 00774 qh_appendprint (qh_PRINTvertices); 00775 break; 00776 case 'V': 00777 qh_option ("FVertex-average", NULL, NULL); 00778 qh_appendprint (qh_PRINTaverage); 00779 break; 00780 case 'x': 00781 qh_option ("Fxtremes", NULL, NULL); 00782 qh_appendprint (qh_PRINTextremes); 00783 break; 00784 default: 00785 s--; 00786 fprintf (qh ferr, "qhull warning: unknown 'F' output option %c, rest ignored\n", (int)s[0]); 00787 while (*++s && !isspace(*s)); 00788 break; 00789 } 00790 } 00791 break; 00792 case 'G': 00793 isgeom= True; 00794 qh_appendprint (qh_PRINTgeom); 00795 while (*s && !isspace(*s)) { 00796 switch(*s++) { 00797 case 'a': 00798 qh_option ("Gall-points", NULL, NULL); 00799 qh PRINTdots= True; 00800 break; 00801 case 'c': 00802 qh_option ("Gcentrums", NULL, NULL); 00803 qh PRINTcentrums= True; 00804 break; 00805 case 'h': 00806 qh_option ("Gintersections", NULL, NULL); 00807 qh DOintersections= True; 00808 break; 00809 case 'i': 00810 qh_option ("Ginner", NULL, NULL); 00811 qh PRINTinner= True; 00812 break; 00813 case 'n': 00814 qh_option ("Gno-planes", NULL, NULL); 00815 qh PRINTnoplanes= True; 00816 break; 00817 case 'o': 00818 qh_option ("Gouter", NULL, NULL); 00819 qh PRINTouter= True; 00820 break; 00821 case 'p': 00822 qh_option ("Gpoints", NULL, NULL); 00823 qh PRINTcoplanar= True; 00824 break; 00825 case 'r': 00826 qh_option ("Gridges", NULL, NULL); 00827 qh PRINTridges= True; 00828 break; 00829 case 't': 00830 qh_option ("Gtransparent", NULL, NULL); 00831 qh PRINTtransparent= True; 00832 break; 00833 case 'v': 00834 qh_option ("Gvertices", NULL, NULL); 00835 qh PRINTspheres= True; 00836 break; 00837 case 'D': 00838 if (!isdigit (*s)) 00839 fprintf (qh ferr, "qhull input error: missing dimension for option 'GDn'\n"); 00840 else { 00841 if (qh DROPdim >= 0) 00842 fprintf (qh ferr, "qhull warning: can only drop one dimension. Previous 'GD%d' ignored\n", 00843 qh DROPdim); 00844 qh DROPdim= qh_strtol (s, &s); 00845 qh_option ("GDrop-dim", &qh DROPdim, NULL); 00846 } 00847 break; 00848 default: 00849 s--; 00850 fprintf (qh ferr, "qhull warning: unknown 'G' print option %c, rest ignored\n", (int)s[0]); 00851 while (*++s && !isspace(*s)); 00852 break; 00853 } 00854 } 00855 break; 00856 case 'P': 00857 while (*s && !isspace(*s)) { 00858 switch(*s++) { 00859 case 'd': case 'D': /* see qh_initthresholds() */ 00860 key= s[-1]; 00861 i= qh_strtol (s, &s); 00862 r= 0; 00863 if (*s == ':') { 00864 s++; 00865 r= qh_strtod (s, &s); 00866 } 00867 if (key == 'd') 00868 qh_option ("Pdrop-facets-dim-less", &i, &r); 00869 else 00870 qh_option ("PDrop-facets-dim-more", &i, &r); 00871 break; 00872 case 'g': 00873 qh_option ("Pgood-facets", NULL, NULL); 00874 qh PRINTgood= True; 00875 break; 00876 case 'G': 00877 qh_option ("PGood-facet-neighbors", NULL, NULL); 00878 qh PRINTneighbors= True; 00879 break; 00880 case 'o': 00881 qh_option ("Poutput-forced", NULL, NULL); 00882 qh FORCEoutput= True; 00883 break; 00884 case 'p': 00885 qh_option ("Pprecision-ignore", NULL, NULL); 00886 qh PRINTprecision= False; 00887 break; 00888 case 'A': 00889 if (!isdigit (*s)) 00890 fprintf (qh ferr, "qhull input error: missing facet count for keep area option 'PAn'\n"); 00891 else { 00892 qh KEEParea= qh_strtol (s, &s); 00893 qh_option ("PArea-keep", &qh KEEParea, NULL); 00894 qh GETarea= True; 00895 } 00896 break; 00897 case 'F': 00898 if (!isdigit (*s)) 00899 fprintf (qh ferr, "qhull input error: missing facet area for option 'PFn'\n"); 00900 else { 00901 qh KEEPminArea= qh_strtod (s, &s); 00902 qh_option ("PFacet-area-keep", NULL, &qh KEEPminArea); 00903 qh GETarea= True; 00904 } 00905 break; 00906 case 'M': 00907 if (!isdigit (*s)) 00908 fprintf (qh ferr, "qhull input error: missing merge count for option 'PMn'\n"); 00909 else { 00910 qh KEEPmerge= qh_strtol (s, &s); 00911 qh_option ("PMerge-keep", &qh KEEPmerge, NULL); 00912 } 00913 break; 00914 default: 00915 s--; 00916 fprintf (qh ferr, "qhull warning: unknown 'P' print option %c, rest ignored\n", (int)s[0]); 00917 while (*++s && !isspace(*s)); 00918 break; 00919 } 00920 } 00921 break; 00922 case 'Q': 00923 lastproject= -1; 00924 while (*s && !isspace(*s)) { 00925 switch(*s++) { 00926 case 'b': case 'B': /* handled by qh_initthresholds */ 00927 key= s[-1]; 00928 if (key == 'b' && *s == 'B') { 00929 s++; 00930 r= qh_DEFAULTbox; 00931 qh SCALEinput= True; 00932 qh_option ("QbBound-unit-box", NULL, &r); 00933 break; 00934 } 00935 if (key == 'b' && *s == 'b') { 00936 s++; 00937 qh SCALElast= True; 00938 qh_option ("Qbbound-last", NULL, NULL); 00939 break; 00940 } 00941 k= qh_strtol (s, &s); 00942 r= 0.0; 00943 wasproject= False; 00944 if (*s == ':') { 00945 s++; 00946 if ((r= qh_strtod(s, &s)) == 0.0) { 00947 t= s; /* need true dimension for memory allocation */ 00948 while (*t && !isspace(*t)) { 00949 if (toupper(*t++) == 'B' 00950 && k == qh_strtol (t, &t) 00951 && *t++ == ':' 00952 && qh_strtod(t, &t) == 0.0) { 00953 qh PROJECTinput++; 00954 trace2((qh ferr, "qh_initflags: project dimension %d\n", k)); 00955 qh_option ("Qb-project-dim", &k, NULL); 00956 wasproject= True; 00957 lastproject= k; 00958 break; 00959 } 00960 } 00961 } 00962 } 00963 if (!wasproject) { 00964 if (lastproject == k && r == 0.0) 00965 lastproject= -1; /* doesn't catch all possible sequences */ 00966 else if (key == 'b') { 00967 qh SCALEinput= True; 00968 if (r == 0.0) 00969 r= -qh_DEFAULTbox; 00970 qh_option ("Qbound-dim-low", &k, &r); 00971 }else { 00972 qh SCALEinput= True; 00973 if (r == 0.0) 00974 r= qh_DEFAULTbox; 00975 qh_option ("QBound-dim-high", &k, &r); 00976 } 00977 } 00978 break; 00979 case 'c': 00980 qh_option ("Qcoplanar-keep", NULL, NULL); 00981 qh KEEPcoplanar= True; 00982 break; 00983 case 'f': 00984 qh_option ("Qfurthest-outside", NULL, NULL); 00985 qh BESToutside= True; 00986 break; 00987 case 'g': 00988 qh_option ("Qgood-facets-only", NULL, NULL); 00989 qh ONLYgood= True; 00990 break; 00991 case 'i': 00992 qh_option ("Qinterior-keep", NULL, NULL); 00993 qh KEEPinside= True; 00994 break; 00995 case 'm': 00996 qh_option ("Qmax-outside-only", NULL, NULL); 00997 qh ONLYmax= True; 00998 break; 00999 case 'r': 01000 qh_option ("Qrandom-outside", NULL, NULL); 01001 qh RANDOMoutside= True; 01002 break; 01003 case 's': 01004 qh_option ("Qsearch-initial-simplex", NULL, NULL); 01005 qh ALLpoints= True; 01006 break; 01007 case 'u': 01008 qh_option ("QupperDelaunay", NULL, NULL); 01009 qh UPPERdelaunay= True; 01010 break; 01011 case 'v': 01012 qh_option ("Qvertex-neighbors-convex", NULL, NULL); 01013 qh TESTvneighbors= True; 01014 break; 01015 case 'x': 01016 qh_option ("Qxact-merge", NULL, NULL); 01017 qh MERGEexact= True; 01018 break; 01019 case 'z': 01020 qh_option ("Qz-infinity-point", NULL, NULL); 01021 qh ATinfinity= True; 01022 break; 01023 case '0': 01024 qh_option ("Q0-no-premerge", NULL, NULL); 01025 qh NOpremerge= True; 01026 break; 01027 case '1': 01028 qh_option ("Q1-no-angle-sort", NULL, NULL); 01029 qh ANGLEmerge= False; 01030 goto LABELcheckdigit; 01031 break; /* no warnings */ 01032 case '2': 01033 qh_option ("Q2-no-merge-independent", NULL, NULL); 01034 qh MERGEindependent= False; 01035 goto LABELcheckdigit; 01036 break; /* no warnings */ 01037 case '3': 01038 qh_option ("Q3-no-merge-vertices", NULL, NULL); 01039 qh MERGEvertices= False; 01040 LABELcheckdigit: 01041 if (isdigit(*s)) 01042 fprintf (qh ferr, "qhull warning: can not follow '1', '2', or '3' with a digit. '%c' skipped.\n", 01043 *s++); 01044 break; 01045 case '4': 01046 qh_option ("Q4-avoid-old-into-new", NULL, NULL); 01047 qh AVOIDold= True; 01048 break; 01049 case '5': 01050 qh_option ("Q5-no-check-outer", NULL, NULL); 01051 qh SKIPcheckmax= True; 01052 break; 01053 case '6': 01054 qh_option ("Q6-no-concave-merge", NULL, NULL); 01055 qh SKIPconvex= True; 01056 break; 01057 case '7': 01058 qh_option ("Q7-no-breadth-first", NULL, NULL); 01059 qh VIRTUALmemory= True; 01060 break; 01061 case '8': 01062 qh_option ("Q8-no-near-inside", NULL, NULL); 01063 qh NOnearinside= True; 01064 break; 01065 case '9': 01066 qh_option ("Q9-pick-furthest", NULL, NULL); 01067 qh PICKfurthest= True; 01068 break; 01069 case 'G': 01070 i= qh_strtol (s, &t); 01071 if (qh GOODpoint) 01072 fprintf (qh ferr, "qhull warning: good point already defined for option 'QGn'. Ignored\n"); 01073 else if (s == t) 01074 fprintf (qh ferr, "qhull warning: missing good point id for option 'QGn'. Ignored\n"); 01075 else if (i < 0 || *s == '-') { 01076 qh GOODpoint= i-1; 01077 qh_option ("QGood-if-dont-see-point", &i, NULL); 01078 }else { 01079 qh GOODpoint= i+1; 01080 qh_option ("QGood-if-see-point", &i, NULL); 01081 } 01082 s= t; 01083 break; 01084 case 'J': 01085 if (!isdigit(*s) && *s != '-') 01086 qh JOGGLEmax= 0.0; 01087 else { 01088 qh JOGGLEmax= (realT) qh_strtod (s, &s); 01089 qh_option ("QJoggle", NULL, &qh JOGGLEmax); 01090 } 01091 break; 01092 case 'R': 01093 if (!isdigit(*s) && *s != '-') 01094 fprintf (qh ferr, "qhull warning: missing random seed for option 'QRn'. Ignored\n"); 01095 else { 01096 qh ROTATErandom= i= qh_strtol(s, &s); 01097 if (i > 0) 01098 qh_option ("QRotate-id", &i, NULL ); 01099 else if (i < -1) 01100 qh_option ("QRandom-seed", &i, NULL ); 01101 } 01102 break; 01103 case 'V': 01104 i= qh_strtol (s, &t); 01105 if (qh GOODvertex) 01106 fprintf (qh ferr, "qhull warning: good vertex already defined for option 'QVn'. Ignored\n"); 01107 else if (s == t) 01108 fprintf (qh ferr, "qhull warning: no good point id given for option 'QVn'. Ignored\n"); 01109 else if (i < 0) { 01110 qh GOODvertex= i - 1; 01111 qh_option ("QV-good-facets-not-point", &i, NULL); 01112 }else { 01113 qh_option ("QV-good-facets-point", &i, NULL); 01114 qh GOODvertex= i + 1; 01115 } 01116 s= t; 01117 break; 01118 default: 01119 s--; 01120 fprintf (qh ferr, "qhull warning: unknown 'Q' qhull option %c, rest ignored\n", (int)s[0]); 01121 while (*++s && !isspace(*s)); 01122 break; 01123 } 01124 } 01125 break; 01126 case 'T': 01127 while (*s && !isspace(*s)) { 01128 if (isdigit(*s) || *s == '-') 01129 qh IStracing= qh_strtol(s, &s); 01130 else switch(*s++) { 01131 case 'c': 01132 qh_option ("Tcheck-frequently", NULL, NULL); 01133 qh CHECKfrequently= True; 01134 break; 01135 case 's': 01136 qh_option ("Tstatistics", NULL, NULL); 01137 qh PRINTstatistics= True; 01138 break; 01139 case 'v': 01140 qh_option ("Tverify", NULL, NULL); 01141 qh VERIFYoutput= True; 01142 break; 01143 case 'z': 01144 if (!qh fout) 01145 fprintf (qh ferr, "qhull warning: output file undefined (stdout). Option 'Tz' ignored.\n"); 01146 else { 01147 qh_option ("Tz-stdout", NULL, NULL); 01148 qh ferr= qh fout; 01149 qhmem.ferr= qh fout; 01150 } 01151 break; 01152 case 'C': 01153 if (!isdigit(*s)) 01154 fprintf (qh ferr, "qhull warning: missing point id for cone for trace option 'TCn'. Ignored\n"); 01155 else { 01156 i= qh_strtol (s, &s); 01157 qh_option ("TCone-stop", &i, NULL); 01158 qh STOPcone= i + 1; 01159 } 01160 break; 01161 case 'F': 01162 if (!isdigit(*s)) 01163 fprintf (qh ferr, "qhull warning: missing frequency count for trace option 'TFn'. Ignored\n"); 01164 else { 01165 qh REPORTfreq= qh_strtol (s, &s); 01166 qh_option ("TFacet-log", &qh REPORTfreq, NULL); 01167 qh REPORTfreq2= qh REPORTfreq/2; /* for tracemerging() */ 01168 } 01169 break; 01170 case 'O': 01171 if (s[0] != ' ' || s[1] == '\"' || isspace (s[1])) { 01172 s++; 01173 fprintf (qh ferr, "qhull warning: option 'TO' mistyped.\nUse 'TO', one space, file name, and space or end-of-line.\nThe file name may be enclosed in single quotes.\nDo not use double quotes. Option 'FO' ignored.\n"); 01174 }else { /* not a procedure because of qh_option (filename, NULL, NULL); */ 01175 char filename[500], *t= filename; 01176 boolT isquote= False; 01177 01178 s++; 01179 if (*s == '\'') { 01180 isquote= True; 01181 s++; 01182 } 01183 while (*s) { 01184 if (t - filename >= sizeof (filename)-2) { 01185 fprintf (qh ferr, "qhull error: filename for 'TO' too long.\n"); 01186 qh_errexit (qh_ERRinput, NULL, NULL); 01187 } 01188 if (isquote) { 01189 if (*s == '\'') { 01190 s++; 01191 isquote= False; 01192 break; 01193 } 01194 }else if (isspace (*s)) 01195 break; 01196 *(t++)= *s++; 01197 } 01198 *t= '\0'; 01199 if (isquote) 01200 fprintf (qh ferr, "qhull error: missing end quote for option 'TO'. Rest of line ignored.\n"); 01201 else if (!freopen (filename, "w", stdout)) { 01202 fprintf (qh ferr, "qhull error: could not open file \"%s\".", filename); 01203 qh_errexit (qh_ERRinput, NULL, NULL); 01204 }else { 01205 qh_option ("TOutput-file", NULL, NULL); 01206 qh_option (filename, NULL, NULL); 01207 } 01208 } 01209 break; 01210 case 'P': 01211 if (!isdigit(*s)) 01212 fprintf (qh ferr, "qhull warning: missing point id for trace option 'TPn'. Ignored\n"); 01213 else { 01214 qh TRACEpoint= qh_strtol (s, &s); 01215 qh_option ("Trace-point", &qh TRACEpoint, NULL); 01216 } 01217 break; 01218 case 'M': 01219 if (!isdigit(*s)) 01220 fprintf (qh ferr, "qhull warning: missing merge id for trace option 'TMn'. Ignored\n"); 01221 else { 01222 qh TRACEmerge= qh_strtol (s, &s); 01223 qh_option ("Trace-merge", &qh TRACEmerge, NULL); 01224 } 01225 break; 01226 case 'R': 01227 if (!isdigit(*s)) 01228 fprintf (qh ferr, "qhull warning: missing rerun count for trace option 'TRn'. Ignored\n"); 01229 else { 01230 qh RERUN= qh_strtol (s, &s); 01231 qh_option ("TRerun", &qh RERUN, NULL); 01232 } 01233 break; 01234 case 'V': 01235 i= qh_strtol (s, &t); 01236 if (s == t) 01237 fprintf (qh ferr, "qhull warning: missing furthest point id for trace option 'TVn'. Ignored\n"); 01238 else if (i < 0) { 01239 qh STOPpoint= i - 1; 01240 qh_option ("TV-stop-before-point", &i, NULL); 01241 }else { 01242 qh STOPpoint= i + 1; 01243 qh_option ("TV-stop-after-point", &i, NULL); 01244 } 01245 s= t; 01246 break; 01247 case 'W': 01248 if (!isdigit(*s)) 01249 fprintf (qh ferr, "qhull warning: missing max width for trace option 'TWn'. Ignored\n"); 01250 else { 01251 qh TRACEdist= (realT) qh_strtod (s, &s); 01252 qh_option ("TWide-trace", NULL, &qh TRACEdist); 01253 } 01254 break; 01255 default: 01256 s--; 01257 fprintf (qh ferr, "qhull warning: unknown 'T' trace option %c, rest ignored\n", (int)s[0]); 01258 while (*++s && !isspace(*s)); 01259 break; 01260 } 01261 } 01262 break; 01263 default: 01264 fprintf (qh ferr, "qhull warning: unknown flag %c (%x)\n", (int)s[-1], 01265 (int)s[-1]); 01266 break; 01267 } 01268 if (s-1 == prev_s && *s && !isspace(*s)) { 01269 fprintf (qh ferr, "qhull warning: missing space after flag %c (%x); reserved for menu. Skipped.\n", 01270 (int)*prev_s, (int)*prev_s); 01271 while (*s && !isspace(*s)) 01272 s++; 01273 } 01274 } 01275 if (isgeom && !qh FORCEoutput && qh PRINTout[1]) 01276 fprintf (qh ferr, "qhull warning: additional output formats are not compatible with Geomview\n"); 01277 /* set derived values in qh_initqhull_globals */ 01278 } /* initflags */ |
|
Definition at line 1290 of file global.c. References coordT, qh, qh_memalloc(), qh_setnew(), REALmax, realT, and SETelemsize. Referenced by qh_init_B().
01290 { 01291 int k; 01292 01293 qh TEMPsize= (qhmem.LASTsize - sizeof (setT))/SETelemsize; 01294 if (qh TEMPsize <= 0 || qh TEMPsize > qhmem.LASTsize) 01295 qh TEMPsize= 8; /* e.g., if qh_NOmem */ 01296 qh other_points= qh_setnew (qh TEMPsize); 01297 qh del_vertices= qh_setnew (qh TEMPsize); 01298 qh searchset= qh_setnew (qh TEMPsize); 01299 qh NEARzero= (realT *)qh_memalloc(qh hull_dim * sizeof(realT)); 01300 qh lower_threshold= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT)); 01301 qh upper_threshold= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT)); 01302 qh lower_bound= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT)); 01303 qh upper_bound= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT)); 01304 for(k= qh input_dim+1; k--; ) { 01305 qh lower_threshold[k]= -REALmax; 01306 qh upper_threshold[k]= REALmax; 01307 qh lower_bound[k]= -REALmax; 01308 qh upper_bound[k]= REALmax; 01309 } 01310 qh gm_matrix= (coordT *)qh_memalloc((qh hull_dim+1) * qh hull_dim * sizeof(coordT)); 01311 qh gm_row= (coordT **)qh_memalloc((qh hull_dim+1) * sizeof(coordT *)); 01312 } /* initqhull_buffers */ |
|
Definition at line 1345 of file global.c. References boolT, coordT, i, MERGING, num_points, qh, qh_AScentrum, qh_ASvoronoi, qh_DIMmergeVertex, qh_errexit(), qh_ERRinput, qh_ERRqhull, qh_HASHfactor, qh_option(), qh_PRINTcentrums, qh_PRINTcoplanars, qh_PRINTEND, qh_PRINTgeom, qh_PRINTmathematica, qh_PRINTpointintersect, qh_PRINTpointnearest, qh_PRINTtriangles, qh_PRINTvertices, qh_RANDOMint, qh_RANDOMmax, qh_RANDOMseed_, REALepsilon, REALmax, realT, seed, trace0, and trace2. Referenced by qh_init_B().
01345 { 01346 int seed, pointsneeded, extra= 0, i, randi, k; 01347 boolT printgeom= False, printmath= False, printcoplanar= False; 01348 realT randr; 01349 realT factorial; 01350 01351 time_t timedata; 01352 01353 trace0((qh ferr, "qh_initqhull_globals: for %s | %s\n", qh rbox_command, 01354 qh qhull_command)); 01355 qh POINTSmalloc= ismalloc; 01356 qh first_point= points; 01357 qh num_points= numpoints; 01358 qh hull_dim= qh input_dim= dim; 01359 if (!qh NOpremerge && !qh MERGEexact && !qh PREmerge && qh JOGGLEmax > REALmax/2) { 01360 qh MERGING= True; 01361 if (qh hull_dim <= 4) { 01362 qh PREmerge= True; 01363 qh_option ("_pre-merge", NULL, NULL); 01364 }else { 01365 qh MERGEexact= True; 01366 qh_option ("Qxact_merge", NULL, NULL); 01367 } 01368 }else if (qh MERGEexact) 01369 qh MERGING= True; 01370 if (!qh NOpremerge && qh JOGGLEmax > REALmax/2) { 01371 #ifdef qh_NOmerge 01372 qh JOGGLEmax= 0.0; 01373 #endif 01374 } 01375 if (qh JOGGLEmax < REALmax/2 && qh DELAUNAY && !qh SCALEinput && !qh SCALElast) { 01376 qh SCALElast= True; 01377 qh_option ("Qbbound-last-qj", NULL, NULL); 01378 } 01379 if (qh MERGING && !qh POSTmerge && qh premerge_cos > REALmax/2 01380 && qh premerge_centrum == 0) { 01381 qh ZEROcentrum= True; 01382 qh ZEROall_ok= True; 01383 qh_option ("_zero-centrum", NULL, NULL); 01384 } 01385 if (qh JOGGLEmax < REALmax/2 && REALepsilon > 2e-8 && qh PRINTprecision) 01386 fprintf(qh ferr, "qhull warning: real epsilon, %2.2g, is probably too large for joggle ('QJn')\nRecompile with double precision reals (see user.h).\n", 01387 REALepsilon); 01388 #ifdef qh_NOmerge 01389 if (qh MERGING) { 01390 fprintf (qh ferr, "qhull input error: merging not installed (qh_NOmerge + 'Qx', 'Cn' or 'An')\n"); 01391 qh_errexit (qh_ERRinput, NULL, NULL); 01392 } 01393 #endif 01394 if (!(qh PRINTgood || qh PRINTneighbors)) { 01395 if (qh KEEParea || qh KEEPminArea < REALmax/2 || qh KEEPmerge || qh DELAUNAY 01396 || (!qh ONLYgood && (qh GOODvertex || qh GOODpoint))) { 01397 qh PRINTgood= True; 01398 qh_option ("Pgood", NULL, NULL); 01399 } 01400 } 01401 if (qh DELAUNAY && qh KEEPcoplanar && !qh KEEPinside) { 01402 qh KEEPinside= True; 01403 qh_option ("Qinterior-keep", NULL, NULL); 01404 } 01405 if (qh DELAUNAY && qh HALFspace) { 01406 fprintf (qh ferr, "qhull input error: can not use Delaunay ('d') or Voronoi ('v') with halfspace intersection ('H')\n"); 01407 qh_errexit (qh_ERRinput, NULL, NULL); 01408 } 01409 if (!qh DELAUNAY && (qh UPPERdelaunay || qh ATinfinity)) { 01410 fprintf (qh ferr, "qhull input error: use upper-Delaunay ('Qu') or infinity-point ('Qz') with Delaunay ('d') or Voronoi ('v')\n"); 01411 qh_errexit (qh_ERRinput, NULL, NULL); 01412 } 01413 if (qh UPPERdelaunay && qh ATinfinity) { 01414 fprintf (qh ferr, "qhull input error: can not use infinity-point ('Qz') with upper-Delaunay ('Qu')\n"); 01415 qh_errexit (qh_ERRinput, NULL, NULL); 01416 } 01417 if (qh SCALElast && !qh DELAUNAY && qh PRINTprecision) 01418 fprintf (qh ferr, "qhull input warning: option 'Qbb' (scale-last-coordinate) is normally used with 'd' or 'v'\n"); 01419 qh DOcheckmax= (!qh FORCEoutput && !qh SKIPcheckmax && qh MERGING ); 01420 qh KEEPnearinside= (qh DOcheckmax && !(qh KEEPinside && qh KEEPcoplanar) 01421 && !qh NOnearinside); 01422 if (qh MERGING) 01423 qh CENTERtype= qh_AScentrum; 01424 else if (qh VORONOI) 01425 qh CENTERtype= qh_ASvoronoi; 01426 if (qh TESTvneighbors && !qh MERGING) { 01427 fprintf(qh ferr, "qhull input error: test vertex neighbors ('Qv') needs a merge option\n"); 01428 qh_errexit (qh_ERRinput, NULL ,NULL); 01429 } 01430 if (qh PROJECTinput || (qh DELAUNAY && qh PROJECTdelaunay)) { 01431 qh hull_dim -= qh PROJECTinput; 01432 if (qh DELAUNAY) { 01433 qh hull_dim++; 01434 extra= 1; 01435 } 01436 } 01437 if (qh hull_dim <= 1) { 01438 fprintf(qh ferr, "qhull error: dimension %d must be > 1\n", qh hull_dim); 01439 qh_errexit (qh_ERRinput, NULL, NULL); 01440 } 01441 for (k= 2, factorial=1.0; k < qh hull_dim; k++) 01442 factorial *= k; 01443 qh AREAfactor= 1.0 / factorial; 01444 trace2((qh ferr, "qh_initqhull_globals: initialize globals. dim %d numpoints %d malloc? %d projected %d to hull_dim %d\n", 01445 dim, numpoints, ismalloc, qh PROJECTinput, qh hull_dim)); 01446 qh normal_size= qh hull_dim * sizeof(coordT); 01447 qh center_size= qh normal_size - sizeof(coordT); 01448 pointsneeded= qh hull_dim+1; 01449 if (qh hull_dim > qh_DIMmergeVertex) { 01450 qh MERGEvertices= False; 01451 qh_option ("Q3-no-merge-vertices-dim-high", NULL, NULL); 01452 } 01453 if (qh GOODpoint) 01454 pointsneeded++; 01455 #ifdef qh_NOtrace 01456 if (qh IStracing) { 01457 fprintf (qh ferr, "qhull input error: tracing is not installed (qh_NOtrace in user.h)"); 01458 qh_errexit (qh_ERRqhull, NULL, NULL); 01459 } 01460 #endif 01461 if (qh RERUN > 1) { 01462 qh TRACElastrun= qh IStracing; /* qh_build_withrestart duplicates next conditional */ 01463 if (qh IStracing != -1) 01464 qh IStracing= 0; 01465 }else if (qh TRACEpoint != -1 || qh TRACEdist < REALmax/2 || qh TRACEmerge) { 01466 qh TRACElevel= (qh IStracing? qh IStracing : 3); 01467 qh IStracing= 0; 01468 } 01469 if (qh ROTATErandom == 0 || qh ROTATErandom == -1) { 01470 seed= time (&timedata); 01471 if (qh ROTATErandom == -1) { 01472 seed= -seed; 01473 qh_option ("QRandom-seed", &seed, NULL ); 01474 }else 01475 qh_option ("QRotate-random", &seed, NULL); 01476 qh ROTATErandom= seed; 01477 } 01478 seed= qh ROTATErandom; 01479 if (seed == INT_MIN) /* default value */ 01480 seed= 1; 01481 else if (seed < 0) 01482 seed= -seed; 01483 qh_RANDOMseed_(seed); 01484 randr= 0.0; 01485 for (i= 1000; i--; ) { 01486 randi= qh_RANDOMint; 01487 randr += randi; 01488 if (randi > qh_RANDOMmax) { 01489 fprintf (qh ferr, "\ 01490 qhull configuration error (qh_RANDOMmax in user.h):\n\ 01491 random integer %d > qh_RANDOMmax (%.8g)\n", 01492 randi, qh_RANDOMmax); 01493 qh_errexit (qh_ERRinput, NULL, NULL); 01494 } 01495 } 01496 qh_RANDOMseed_(seed); 01497 randr = randr/1000; 01498 if (randr < qh_RANDOMmax/10 01499 || randr > qh_RANDOMmax * 5) 01500 fprintf (qh ferr, "\ 01501 qhull configuration warning (qh_RANDOMmax in user.h):\n\ 01502 average of 1000 random integers (%.2g) is much different than expected (%.2g).\n\ 01503 Is qh_RANDOMmax (%g) wrong?\n", 01504 randr, qh_RANDOMmax/2.0, qh_RANDOMmax); 01505 qh RANDOMa= 2.0 * qh RANDOMfactor/qh_RANDOMmax; 01506 qh RANDOMb= 1.0 - qh RANDOMfactor; 01507 if (qh_HASHfactor < 1.1) { 01508 fprintf(qh ferr, "qhull internal error (qh_initqhull_globals): qh_HASHfactor %d must be at least 1.1. Qhull uses linear hash probing\n", 01509 qh_HASHfactor); 01510 qh_errexit (qh_ERRqhull, NULL, NULL); 01511 } 01512 if (numpoints+extra < pointsneeded) { 01513 fprintf(qh ferr,"qhull input error: not enough points (%d) to construct initial simplex (need %d)\n", 01514 numpoints, pointsneeded); 01515 qh_errexit(qh_ERRinput, NULL, NULL); 01516 } 01517 if (qh PRINTtransparent) { 01518 if (qh hull_dim != 4 || !qh DELAUNAY || qh VORONOI || qh DROPdim >= 0) { 01519 fprintf(qh ferr,"qhull input error: transparent Delaunay ('Gt') needs 3-d Delaunay ('d') w/o 'GDn'\n"); 01520 qh_errexit(qh_ERRinput, NULL, NULL); 01521 } 01522 qh DROPdim = 3; 01523 qh PRINTridges = True; 01524 } 01525 for (i= qh_PRINTEND; i--; ) { 01526 if (qh PRINTout[i] == qh_PRINTgeom) 01527 printgeom= True; 01528 else if (qh PRINTout[i] == qh_PRINTmathematica) 01529 printmath= True; 01530 else if (qh PRINTout[i] == qh_PRINTcoplanars) 01531 printcoplanar= True; 01532 else if (qh PRINTout[i] == qh_PRINTpointnearest) 01533 printcoplanar= True; 01534 else if (qh PRINTout[i] == qh_PRINTpointintersect && !qh HALFspace) { 01535 fprintf (qh ferr, "qhull input error: option 'Fp' is only used for \nhalfspace intersection ('Hn,n,n').\n"); 01536 qh_errexit (qh_ERRinput, NULL, NULL); 01537 }else if (qh PRINTout[i] == qh_PRINTtriangles && (qh HALFspace || qh VORONOI)) { 01538 fprintf (qh ferr, "qhull input error: option 'Ft' is not available for Voronoi vertices or halfspace intersection\n"); 01539 qh_errexit (qh_ERRinput, NULL, NULL); 01540 }else if (qh PRINTout[i] == qh_PRINTcentrums && qh VORONOI) { 01541 fprintf (qh ferr, "qhull input error: option 'FC' is not available for Voronoi vertices ('v')\n"); 01542 qh_errexit (qh_ERRinput, NULL, NULL); 01543 }else if (qh PRINTout[i] == qh_PRINTvertices) { 01544 if (qh VORONOI) 01545 qh_option ("Fvoronoi", NULL, NULL); 01546 else 01547 qh_option ("Fvertices", NULL, NULL); 01548 } 01549 } 01550 if (printcoplanar && qh DELAUNAY && qh JOGGLEmax < REALmax/2) { 01551 if (qh PRINTprecision) 01552 fprintf (qh ferr, "qhull input warning: 'QJ' (joggle) will usually prevent coincident input sites for options 'Fc' and 'FP'\n"); 01553 } 01554 if (!qh KEEPcoplanar && !qh KEEPinside && !qh ONLYgood) { 01555 if ((qh PRINTcoplanar && qh PRINTspheres) || printcoplanar) { 01556 qh KEEPcoplanar = True; 01557 qh_option ("Qcoplanar", NULL, NULL); 01558 } 01559 } 01560 if (printmath && (qh hull_dim > 3 || qh VORONOI)) { 01561 fprintf (qh ferr, "qhull input error: Mathematica output is only available for 2-d and 3-d convex hulls and 2-d Delaunay triangulations\n"); 01562 qh_errexit (qh_ERRinput, NULL, NULL); 01563 } 01564 if (printgeom) { 01565 if (qh hull_dim > 4) { 01566 fprintf (qh ferr, "qhull input error: Geomview output is only available for 2-d, 3-d and 4-d\n"); 01567 qh_errexit (qh_ERRinput, NULL, NULL); 01568 } 01569 if (qh PRINTnoplanes && !(qh PRINTcoplanar + qh PRINTcentrums 01570 + qh PRINTdots + qh PRINTspheres + qh DOintersections + qh PRINTridges)) { 01571 fprintf (qh ferr, "qhull input error: no output specified for Geomview\n"); 01572 qh_errexit (qh_ERRinput, NULL, NULL); 01573 } 01574 if (qh VORONOI && (qh hull_dim > 3 || qh DROPdim >= 0)) { 01575 fprintf (qh ferr, "qhull input error: Geomview output for Voronoi diagrams only for 2-d\n"); 01576 qh_errexit (qh_ERRinput, NULL, NULL); 01577 } 01578 /* can not warn about furthest-site Geomview output: no lower_threshold */ 01579 if (qh hull_dim == 4 && qh DROPdim == -1 && 01580 (qh PRINTcoplanar || qh PRINTspheres || qh PRINTcentrums)) { 01581 fprintf (qh ferr, "qhull input warning: coplanars, vertices, and centrums output not\n\ 01582 available for 4-d output (ignored). Could use 'GDn' instead.\n"); 01583 qh PRINTcoplanar= qh PRINTspheres= qh PRINTcentrums= False; 01584 } 01585 } 01586 qh PRINTdim= qh hull_dim; 01587 if (qh DROPdim >=0) { /* after Geomview checks */ 01588 if (qh DROPdim < qh hull_dim) { 01589 qh PRINTdim--; 01590 if (!printgeom || qh hull_dim < 3) 01591 fprintf (qh ferr, "qhull input warning: drop dimension 'GD%d' is only available for 3-d/4-d Geomview\n", qh DROPdim); 01592 }else 01593 qh DROPdim= -1; 01594 }else if (qh VORONOI) { 01595 qh DROPdim= qh hull_dim-1; 01596 qh PRINTdim= qh hull_dim-1; 01597 } 01598 } /* initqhull_globals */ |
|
Definition at line 1618 of file global.c. References i, MERGING, qh, qh_MEMalign, qh_MEMbufsize, qh_MEMinitbuf, qh_meminitbuffers(), qh_memsetup(), qh_memsize(), qh_user_memsizes(), and SETelemsize. Referenced by qh_init_B().
01618 { 01619 int numsizes; 01620 int i; 01621 01622 numsizes= 8+10; 01623 qh_meminitbuffers (qh IStracing, qh_MEMalign, numsizes, 01624 qh_MEMbufsize,qh_MEMinitbuf); 01625 qh_memsize(sizeof(vertexT)); 01626 if (qh MERGING) { 01627 qh_memsize(sizeof(ridgeT)); 01628 qh_memsize(sizeof(mergeT)); 01629 } 01630 qh_memsize(sizeof(facetT)); 01631 i= sizeof(setT) + (qh hull_dim - 1) * SETelemsize; /* ridge.vertices */ 01632 qh_memsize(i); 01633 qh_memsize(qh normal_size); /* normal */ 01634 i += SETelemsize; /* facet.vertices, .ridges, .neighbors */ 01635 qh_memsize(i); 01636 qh_user_memsizes(); 01637 qh_memsetup(); 01638 } /* initqhull_mem */ |
|
Definition at line 1650 of file global.c. References fmax_, fout, malloc, qh, qh_CPUclock, qh_ERRmem, qh_initstatistics(), qh_RANDOMseed_, REALmax, and REALmin. Referenced by qh_init_A(), and qh_new_qhull().
01650 { 01651 01652 qh_CPUclock; /* start the clock */ 01653 #if qh_QHpointer 01654 if (!(qh_qh= (qhT *)malloc (sizeof(qhT)))) { 01655 fprintf (errfile, "qhull error (qh_initqhull_globals): insufficient memory\n"); 01656 exit (qh_ERRmem); /* no error handler */ 01657 } 01658 memset((char *)qh_qh, 0, sizeof(qhT)); /* every field is 0, FALSE, NULL */ 01659 #else 01660 memset((char *)&qh_qh, 0, sizeof(qhT)); 01661 #endif 01662 strcat (qh qhull, "qhull"); 01663 qh_initstatistics(); 01664 qh ANGLEmerge= True; 01665 qh DROPdim= -1; 01666 qh ferr= errfile; 01667 qh fin= infile; 01668 qh fout= outfile; 01669 qh furthest_id= -1; 01670 qh JOGGLEmax= REALmax; 01671 qh KEEPminArea = REALmax; 01672 qh last_low= REALmax; 01673 qh last_high= REALmax; 01674 qh last_newhigh= REALmax; 01675 qh max_outside= 0.0; 01676 qh max_vertex= 0.0; 01677 qh MAXabs_coord= 0.0; 01678 qh MAXsumcoord= 0.0; 01679 qh MAXwidth= -REALmax; 01680 qh MERGEindependent= True; 01681 qh MINdenom_1= fmax_(1.0/REALmax, REALmin); /* used by qh_scalepoints */ 01682 qh MINoutside= 0.0; 01683 qh MINvisible= REALmax; 01684 qh MAXcoplanar= REALmax; 01685 qh outside_err= REALmax; 01686 qh premerge_centrum= 0.0; 01687 qh premerge_cos= REALmax; 01688 qh PRINTprecision= True; 01689 qh PRINTradius= 0.0; 01690 qh postmerge_cos= REALmax; 01691 qh postmerge_centrum= 0.0; 01692 qh ROTATErandom= INT_MIN; 01693 qh MERGEvertices= True; 01694 qh totarea= 0.0; 01695 qh totvol= 0.0; 01696 qh TRACEdist= REALmax; 01697 qh TRACEpoint= -1; /* recompile to trace a point */ 01698 qh tracefacet_id= UINT_MAX; /* recompile to trace a facet */ 01699 qh tracevertex_id= UINT_MAX; /* recompile to trace a vertex */ 01700 qh_RANDOMseed_(1); 01701 } /* initqhull_start */ |
|
Definition at line 1723 of file global.c. References key, qh, qh_DEFAULTbox, qh_strtod(), qh_strtol(), REALmax, and realT. Referenced by qh_init_B().
01723 { 01724 realT value; 01725 int index, maxdim, k; 01726 char *s= command; 01727 char key; 01728 01729 maxdim= qh input_dim; 01730 if (qh DELAUNAY && (qh PROJECTdelaunay || qh PROJECTinput)) 01731 maxdim++; 01732 while (*s) { 01733 if (*s == '-') 01734 s++; 01735 if (*s == 'P') { 01736 s++; 01737 while (*s && !isspace(key= *s++)) { 01738 if (key == 'd' || key == 'D') { 01739 if (!isdigit(*s)) { 01740 fprintf(qh ferr, "qhull warning: no dimension given for Print option '%c' at: %s. Ignored\n", 01741 key, s-1); 01742 continue; 01743 } 01744 index= qh_strtol (s, &s); 01745 if (index >= qh hull_dim) { 01746 fprintf(qh ferr, "qhull warning: dimension %d for Print option '%c' is >= %d. Ignored\n", 01747 index, key, qh hull_dim); 01748 continue; 01749 } 01750 if (*s == ':') { 01751 s++; 01752 value= qh_strtod(s, &s); 01753 if (fabs((double)value) > 1.0) { 01754 fprintf(qh ferr, "qhull warning: value %2.4g for Print option %c is > +1 or < -1. Ignored\n", 01755 value, key); 01756 continue; 01757 } 01758 }else 01759 value= 0.0; 01760 if (key == 'd') 01761 qh lower_threshold[index]= value; 01762 else 01763 qh upper_threshold[index]= value; 01764 } 01765 } 01766 }else if (*s == 'Q') { 01767 s++; 01768 while (*s && !isspace(key= *s++)) { 01769 if (key == 'b' && *s == 'B') { 01770 s++; 01771 for (k=maxdim; k--; ) { 01772 qh lower_bound[k]= -qh_DEFAULTbox; 01773 qh upper_bound[k]= qh_DEFAULTbox; 01774 } 01775 }else if (key == 'b' && *s == 'b') 01776 s++; 01777 else if (key == 'b' || key == 'B') { 01778 if (!isdigit(*s)) { 01779 fprintf(qh ferr, "qhull warning: no dimension given for Qhull option %c. Ignored\n", 01780 key); 01781 continue; 01782 } 01783 index= qh_strtol (s, &s); 01784 if (index >= maxdim) { 01785 fprintf(qh ferr, "qhull warning: dimension %d for Qhull option %c is >= %d. Ignored\n", 01786 index, key, maxdim); 01787 continue; 01788 } 01789 if (*s == ':') { 01790 s++; 01791 value= qh_strtod(s, &s); 01792 }else if (key == 'b') 01793 value= -qh_DEFAULTbox; 01794 else 01795 value= qh_DEFAULTbox; 01796 if (key == 'b') 01797 qh lower_bound[index]= value; 01798 else 01799 qh upper_bound[index]= value; 01800 } 01801 } 01802 }else { 01803 while (*s && !isspace (*s)) 01804 s++; 01805 } 01806 while (isspace (*s)) 01807 s++; 01808 } 01809 for (k= qh hull_dim; k--; ) { 01810 if (qh lower_threshold[k] > -REALmax/2) { 01811 qh GOODthreshold= True; 01812 if (qh upper_threshold[k] < REALmax/2) { 01813 qh SPLITthresholds= True; 01814 qh GOODthreshold= False; 01815 break; 01816 } 01817 }else if (qh upper_threshold[k] < REALmax/2) 01818 qh GOODthreshold= True; 01819 } 01820 } /* initthresholds */ |
|
Definition at line 206 of file qhulldir/mem.c. References qhmemT::cntlong, qhmemT::curbuffer, free, qhmemT::freelong, qhmemT::LASTsize, and qhmemT::totlong. Referenced by main().
00206 { 00207 void *buffer, *nextbuffer; 00208 00209 *curlong= qhmem .cntlong - qhmem .freelong; 00210 *totlong= qhmem .totlong; 00211 for(buffer= qhmem.curbuffer; buffer; buffer= nextbuffer) { 00212 nextbuffer= *((void **) buffer); 00213 free(buffer); 00214 } 00215 qhmem.curbuffer= NULL; 00216 if (qhmem .LASTsize) { 00217 free (qhmem .indextable); 00218 free (qhmem .freelists); 00219 free (qhmem .sizetable); 00220 } 00221 memset((char *)&qhmem, 0, sizeof qhmem); /* every field is 0, FALSE, NULL */ 00222 } /* memfreeshort */ |
|
Definition at line 231 of file qhulldir/mem.c. References qhmemT::ferr. Referenced by qh_init_A(), and qh_new_qhull().
00231 { 00232 00233 memset((char *)&qhmem, 0, sizeof qhmem); /* every field is 0, FALSE, NULL */ 00234 qhmem.ferr= ferr; 00235 if (sizeof(void*) < sizeof(int)) { 00236 fprintf (ferr, "qhull internal error (qh_meminit): sizeof(void*) < sizeof(int). qset.c will not work\n"); 00237 exit (1); /* can not use qh_errexit() */ 00238 } 00239 } /* meminit */ |
|
Definition at line 2077 of file poly2.c. References FOREACHvertex_, vertexT::point, pointT, qh, qh_pointdist(), REALmax, realT, and facetT::vertices. Referenced by qh_printafacet().
02077 { 02078 realT bestdist= REALmax, dist; 02079 vertexT *bestvertex= NULL, *vertex, **vertexp; 02080 int dim= qh hull_dim; 02081 02082 if (qh DELAUNAY) 02083 dim--; 02084 FOREACHvertex_(facet->vertices) { 02085 dist= qh_pointdist (vertex->point, point, -dim); 02086 if (dist < bestdist) { 02087 bestdist= dist; 02088 bestvertex= vertex; 02089 } 02090 } 02091 *bestdistp= sqrt (bestdist); 02092 return bestvertex; 02093 } /* nearvertex */ |
|
Definition at line 120 of file user.c. References boolT, coordT, free, qh, qh_check_output(), qh_check_points(), qh_init_B(), qh_initflags(), qh_initqhull_start(), qh_meminit(), qh_produce_output(), qh_qhull(), qh_setfeasible(), qh_sethalfspace_all(), and trace1.
00121 { 00122 int exitcode, hulldim; 00123 boolT new_ismalloc; 00124 static boolT firstcall = True; 00125 coordT *new_points; 00126 00127 if (firstcall) { 00128 qh_meminit (errfile); 00129 firstcall= False; 00130 } 00131 if (strncmp (qhull_cmd,"qhull ", 6)) { 00132 fprintf (errfile, "qh_new_qhull: start qhull_cmd argument with \"qhull \"\n"); 00133 exit(1); 00134 } 00135 qh_initqhull_start (NULL, outfile, errfile); 00136 trace1(( qh ferr, "qh_new_qhull: build new Qhull for %d %d-d points with %s\n", numpoints, dim, qhull_cmd)); 00137 exitcode = setjmp (qh errexit); 00138 if (!exitcode) 00139 { 00140 qh NOerrexit = False; 00141 qh_initflags (qhull_cmd); 00142 if (qh DELAUNAY) 00143 qh PROJECTdelaunay= True; 00144 if (qh HALFspace) { 00145 /* points is an array of halfspaces, 00146 the last coordinate of each halfspace is its offset */ 00147 hulldim= dim-1; 00148 qh_setfeasible (hulldim); 00149 new_points= qh_sethalfspace_all (dim, numpoints, points, qh feasible_point); 00150 new_ismalloc= True; 00151 if (ismalloc) 00152 free (points); 00153 }else { 00154 hulldim= dim; 00155 new_points= points; 00156 new_ismalloc= ismalloc; 00157 } 00158 qh_init_B (new_points, numpoints, hulldim, new_ismalloc); 00159 qh_qhull(); 00160 qh_check_output(); 00161 if (outfile) 00162 qh_produce_output(); 00163 if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone) 00164 qh_check_points(); 00165 } 00166 qh NOerrexit = True; 00167 return exitcode; 00168 } /* new_qhull */ |
|
Definition at line 1320 of file geom2.c. References FOREACHvertex_, facetT::maxoutside, minimize_, vertexT::point, qh, qh_distplane(), qh_maxouter(), qh_MAXoutside, REALmax, realT, facetT::vertices, Zdistio, and zinc_. Referenced by qh_geomplanes(), qh_nearcoplanar(), qh_printafacet(), qh_printfacets(), and qh_printsummary().
01320 { 01321 realT dist, mindist; 01322 vertexT *vertex, **vertexp; 01323 01324 if (outerplane) { 01325 if (!qh_MAXoutside || !facet || !qh maxoutdone) { 01326 *outerplane= qh_maxouter(); /* includes qh.DISTround */ 01327 }else { /* qh_MAXoutside ... */ 01328 #if qh_MAXoutside 01329 *outerplane= facet->maxoutside + qh DISTround; 01330 #endif 01331 01332 } 01333 if (qh JOGGLEmax < REALmax/2) 01334 *outerplane += qh JOGGLEmax * sqrt (qh hull_dim); 01335 } 01336 if (innerplane) { 01337 if (facet) { 01338 mindist= REALmax; 01339 FOREACHvertex_(facet->vertices) { 01340 zinc_(Zdistio); 01341 qh_distplane (vertex->point, facet, &dist); 01342 minimize_(mindist, dist); 01343 } 01344 *innerplane= mindist - qh DISTround; 01345 }else 01346 *innerplane= qh min_vertex - qh DISTround; 01347 if (qh JOGGLEmax < REALmax/2) 01348 *innerplane -= qh JOGGLEmax * sqrt (qh hull_dim); 01349 } 01350 } /* outerinner */ |
|
Definition at line 2240 of file poly2.c. References num_points, pointT, qh, qh_setsize(), and SETelemt_. Referenced by qh_check_bestdist(), qh_check_maxout(), qh_initbuild(), and qh_initialvertices().
02240 { 02241 02242 if (id < 0) 02243 return NULL; 02244 if (id < qh num_points) 02245 return qh first_point + id * qh hull_dim; 02246 id -= qh num_points; 02247 if (id < qh_setsize (qh other_points)) 02248 return SETelemt_(qh other_points, id, pointT); 02249 return NULL; 02250 } /* point */ |
|
Definition at line 2304 of file poly2.c. References facetT::coplanarset, FORALLfacets, FOREACHpoint_, FOREACHvertex_, num_points, facetT::outsideset, vertexT::point, pointT, qh, qh_point_add(), qh_setsize(), qh_settemp(), qh_setzero(), facetT::vertices, and vertexT::visitid.
02304 { 02305 int numpoints= qh num_points + qh_setsize (qh other_points); 02306 setT *facets; 02307 facetT *facet; 02308 vertexT *vertex, **vertexp; 02309 pointT *point, **pointp; 02310 02311 facets= qh_settemp (numpoints); 02312 qh_setzero (facets, 0, numpoints); 02313 qh vertex_visit++; 02314 FORALLfacets { 02315 FOREACHvertex_(facet->vertices) { 02316 if (vertex->visitid != qh vertex_visit) { 02317 vertex->visitid= qh vertex_visit; 02318 qh_point_add (facets, vertex->point, facet); 02319 } 02320 } 02321 FOREACHpoint_(facet->coplanarset) 02322 qh_point_add (facets, point, facet); 02323 FOREACHpoint_(facet->outsideset) 02324 qh_point_add (facets, point, facet); 02325 } 02326 return facets; 02327 } /* pointfacet */ |
|
|
Definition at line 2341 of file poly2.c. References FORALLvertices, num_points, vertexT::point, qh, qh_point_add(), qh_setsize(), qh_settemp(), and qh_setzero().
02341 { 02342 int numpoints= qh num_points + qh_setsize (qh other_points); 02343 setT *vertices; 02344 vertexT *vertex; 02345 02346 vertices= qh_settemp (numpoints); 02347 qh_setzero (vertices, 0, numpoints); 02348 FORALLvertices 02349 qh_point_add (vertices, vertex->point, vertex); 02350 return vertices; 02351 } /* pointvertex */ |
|
Definition at line 515 of file stat.c.
00515 { 00516 00517 qh_allstatistics(); 00518 qh_collectstatistics(); 00519 qh_printstatistics (fp, string); 00520 qh_memstatistics (fp); 00521 } |
|
Definition at line 302 of file user.c. References boolT, FORALLfacet_, FOREACHfacet_, qh, qh_printafacet(), qh_printbegin(), qh_printend(), and qh_PRINTfacets. Referenced by qh_addpoint(), qh_findhorizon(), qh_makenewfacets(), qh_matchnewfacets(), and qh_partitionall().
00302 { 00303 facetT *facet, **facetp; 00304 00305 qh_printbegin (qh ferr, qh_PRINTfacets, facetlist, facets, printall); 00306 FORALLfacet_(facetlist) 00307 qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall); 00308 FOREACHfacet_(facets) 00309 qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall); 00310 qh_printend (qh ferr, qh_PRINTfacets, facetlist, facets, printall); 00311 } /* printfacetlist */ |
|
Definition at line 2848 of file qhulldir/io.c. References boolT, FOREACHneighbor_, format, facetT::neighbors, qh, qh_findgood_all(), qh_printfacets(), qh_PRINTnone, qh_setappend(), qh_settemp(), qh_settempfree(), qh_skipfacet(), and facetT::visitid. Referenced by qh_errprint().
02848 { 02849 facetT *neighbor, **neighborp, *facet; 02850 setT *facets; 02851 02852 if (format == qh_PRINTnone) 02853 return; 02854 qh_findgood_all (qh facet_list); 02855 if (facetA == facetB) 02856 facetB= NULL; 02857 facets= qh_settemp (2*(qh_setsize (facetA->neighbors)+1)); 02858 qh visit_id++; 02859 for (facet= facetA; facet; facet= ((facet == facetA) ? facetB : NULL)) { 02860 if (facet->visitid != qh visit_id) { 02861 facet->visitid= qh visit_id; 02862 qh_setappend (&facets, facet); 02863 } 02864 FOREACHneighbor_(facet) { 02865 if (neighbor->visitid == qh visit_id) 02866 continue; 02867 neighbor->visitid= qh visit_id; 02868 if (printall || !qh_skipfacet (neighbor)) 02869 qh_setappend (&facets, neighbor); 02870 } 02871 } 02872 qh_printfacets (fp, format, NULL, facets, printall); 02873 qh_settempfree (&facets); 02874 } /* printneighborhood */ |
|
Definition at line 1161 of file qhull.c.
01161 { 01162 realT ratio, outerplane, innerplane; 01163 float cpu; 01164 int size, id, nummerged, numvertices, numcoplanars= 0, nonsimplicial=0; 01165 int goodused; 01166 facetT *facet; 01167 char *s; 01168 01169 size= qh num_points + qh_setsize (qh other_points); 01170 numvertices= qh num_vertices - qh_setsize (qh del_vertices); 01171 id= qh_pointid (qh GOODpointp); 01172 FORALLfacets { 01173 if (facet->coplanarset) 01174 numcoplanars += qh_setsize( facet->coplanarset); 01175 if (facet->good) { 01176 if (!facet->simplicial && qh_setsize(facet->vertices) != qh hull_dim) 01177 nonsimplicial++; 01178 } 01179 } 01180 if (id >=0 && qh STOPcone-1 != id && -qh STOPpoint-1 != id) 01181 size--; 01182 if (qh STOPcone || qh STOPpoint) 01183 fprintf (fp, "\nAt a premature exit due to 'TVn', 'TCn', or precision error."); 01184 if (qh UPPERdelaunay) 01185 goodused= qh GOODvertex + qh GOODpoint + qh SPLITthresholds; 01186 else if (qh DELAUNAY) 01187 goodused= qh GOODvertex + qh GOODpoint + qh GOODthreshold; 01188 else 01189 goodused= qh num_good; 01190 nummerged= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot); 01191 if (qh VORONOI) { 01192 if (qh UPPERdelaunay) 01193 fprintf (fp, "\n\ 01194 Furthest-site Voronoi vertices by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim); 01195 else 01196 fprintf (fp, "\n\ 01197 Voronoi diagram by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim); 01198 fprintf(fp, " Number of Voronoi regions%s: %d\n", 01199 qh ATinfinity ? " and at-infinity" : "", numvertices); 01200 if (numcoplanars) 01201 fprintf(fp, " Number of nearly incident points: %d\n", numcoplanars); 01202 else if (size > numvertices) 01203 fprintf(fp, " Total number of nearly incident points: %d\n", size - numvertices); 01204 fprintf(fp, " Number of%s Voronoi vertices: %d\n", 01205 goodused ? " 'good'" : "", qh num_good); 01206 if (nonsimplicial) 01207 fprintf(fp, " Number of%s non-simplicial Voronoi vertices: %d\n", 01208 goodused ? " 'good'" : "", nonsimplicial); 01209 }else if (qh DELAUNAY) { 01210 if (qh UPPERdelaunay) 01211 fprintf (fp, "\n\ 01212 Furthest-site Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim); 01213 else 01214 fprintf (fp, "\n\ 01215 Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim); 01216 fprintf(fp, " Number of input sites%s: %d\n", 01217 qh ATinfinity ? " and at-infinity" : "", numvertices); 01218 if (numcoplanars) 01219 fprintf(fp, " Number of nearly incident points: %d\n", numcoplanars); 01220 else if (size > numvertices) 01221 fprintf(fp, " Total number of nearly incident points: %d\n", size - numvertices); 01222 fprintf(fp, " Number of%s Delaunay regions: %d\n", 01223 goodused ? " 'good'" : "", qh num_good); 01224 if (nonsimplicial) 01225 fprintf(fp, " Number of%s non-simplicial Delaunay regions: %d\n", 01226 goodused ? " 'good'" : "", nonsimplicial); 01227 }else if (qh HALFspace) { 01228 fprintf (fp, "\n\ 01229 Halfspace intersection by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim); 01230 fprintf(fp, " Number of halfspaces: %d\n", size); 01231 fprintf(fp, " Number of non-redundant halfspaces: %d\n", numvertices); 01232 if (numcoplanars) { 01233 if (qh KEEPinside && qh KEEPcoplanar) 01234 s= "similar and redundant"; 01235 else if (qh KEEPinside) 01236 s= "redundant"; 01237 else 01238 s= "similar"; 01239 fprintf(fp, " Number of %s halfspaces: %d\n", s, numcoplanars); 01240 } 01241 fprintf(fp, " Number of intersection points: %d\n", qh num_facets - qh num_visible); 01242 if (goodused) 01243 fprintf(fp, " Number of 'good' intersection points: %d\n", qh num_good); 01244 if (nonsimplicial) 01245 fprintf(fp, " Number of%s non-simplicial intersection points: %d\n", 01246 goodused ? " 'good'" : "", nonsimplicial); 01247 }else { 01248 fprintf (fp, "\n\ 01249 Convex hull of %d points in %d-d:\n\n", size, qh hull_dim); 01250 fprintf(fp, " Number of vertices: %d\n", numvertices); 01251 if (numcoplanars) { 01252 if (qh KEEPinside && qh KEEPcoplanar) 01253 s= "coplanar and interior"; 01254 else if (qh KEEPinside) 01255 s= "interior"; 01256 else 01257 s= "coplanar"; 01258 fprintf(fp, " Number of %s points: %d\n", s, numcoplanars); 01259 } 01260 fprintf(fp, " Number of facets: %d\n", qh num_facets - qh num_visible); 01261 if (goodused) 01262 fprintf(fp, " Number of 'good' facets: %d\n", qh num_good); 01263 if (nonsimplicial) 01264 fprintf(fp, " Number of%s non-simplicial facets: %d\n", 01265 goodused ? " 'good'" : "", nonsimplicial); 01266 } 01267 fprintf(fp, "\nStatistics for: %s | %s", 01268 qh rbox_command, qh qhull_command); 01269 if (qh ROTATErandom != INT_MIN) 01270 fprintf(fp, " QR%d\n\n", qh ROTATErandom); 01271 else 01272 fprintf(fp, "\n\n"); 01273 fprintf(fp, " Number of points processed: %d\n", zzval_(Zprocessed)); 01274 fprintf(fp, " Number of hyperplanes created: %d\n", zzval_(Zsetplane)); 01275 if (qh DELAUNAY) 01276 fprintf(fp, " Number of facets in hull: %d\n", qh num_facets - qh num_visible); 01277 fprintf(fp, " Number of distance tests for qhull: %d\n", zzval_(Zpartition)+ 01278 zzval_(Zpartitionall)+zzval_(Znumvisibility)+zzval_(Zpartcoplanar)); 01279 #if 0 /* NOTE: must print before printstatistics() */ 01280 {realT stddev, ave; 01281 fprintf(fp, " average new facet balance: %2.2g\n", 01282 wval_(Wnewbalance)/zval_(Zprocessed)); 01283 stddev= qh_stddev (zval_(Zprocessed), wval_(Wnewbalance), 01284 wval_(Wnewbalance2), &ave); 01285 fprintf(fp, " new facet standard deviation: %2.2g\n", stddev); 01286 fprintf(fp, " average partition balance: %2.2g\n", 01287 wval_(Wpbalance)/zval_(Zpbalance)); 01288 stddev= qh_stddev (zval_(Zpbalance), wval_(Wpbalance), 01289 wval_(Wpbalance2), &ave); 01290 fprintf(fp, " partition standard deviation: %2.2g\n", stddev); 01291 } 01292 #endif 01293 if (nummerged) { 01294 fprintf(fp," Number of merged facets: %d\n", nummerged); 01295 fprintf(fp," Number of distance tests for merging: %d\n",zzval_(Zbestdist)+ 01296 zzval_(Zcentrumtests)+zzval_(Zdistconvex)+zzval_(Zdistcheck)+ 01297 zzval_(Zdistzero)); 01298 } 01299 if (!qh RANDOMoutside && qh QHULLfinished) { 01300 cpu= qh hulltime; 01301 cpu /= qh_SECticks; 01302 wval_(Wcpu)= cpu; 01303 fprintf (fp, " CPU seconds to compute hull (after input): %2.4g\n", cpu); 01304 } 01305 if (qh RERUN) { 01306 if (!qh PREmerge && !qh MERGEexact) 01307 fprintf(fp, " Percentage of runs with precision errors: %4.1f\n", 01308 zzval_(Zretry)*100.0/qh build_cnt); /* careful of order */ 01309 }else if (qh JOGGLEmax < REALmax/2) { 01310 if (zzval_(Zretry)) 01311 fprintf(fp, " After %d retries, input joggled by: %2.2g\n", 01312 zzval_(Zretry), qh JOGGLEmax); 01313 else 01314 fprintf(fp, " Input joggled by: %2.2g\n", qh JOGGLEmax); 01315 } 01316 if (qh totarea != 0.0) 01317 fprintf(fp, " %s facet area: %2.8g\n", 01318 zzval_(Ztotmerge) ? "Approximate" : "Total", qh totarea); 01319 if (qh totvol != 0.0) 01320 fprintf(fp, " %s volume: %2.8g\n", 01321 zzval_(Ztotmerge) ? "Approximate" : "Total", qh totvol); 01322 if (qh MERGING) { 01323 qh_outerinner (NULL, &outerplane, &innerplane); 01324 if (outerplane > 2 * qh DISTround) { 01325 fprintf(fp, " Maximum distance of %spoint above facet: %2.2g", 01326 (qh QHULLfinished ? "" : "merged "), outerplane); 01327 ratio= outerplane/(qh ONEmerge + qh DISTround); 01328 if (ratio > 0.05 && qh ONEmerge > qh MINoutside && qh JOGGLEmax > REALmax/2) 01329 fprintf (fp, " (%.1fx)\n", ratio); 01330 else 01331 fprintf (fp, "\n"); 01332 } 01333 if (innerplane < -2 * qh DISTround) { 01334 fprintf(fp, " Maximum distance of %svertex below facet: %2.2g", 01335 (qh QHULLfinished ? "" : "merged "), innerplane); 01336 ratio= -innerplane/(qh ONEmerge+qh DISTround); 01337 if (ratio > 0.05 && qh JOGGLEmax > REALmax/2) 01338 fprintf (fp, " (%.1fx)\n", ratio); 01339 else 01340 fprintf (fp, "\n"); 01341 } 01342 } 01343 fprintf(fp, "\n"); 01344 } /* printsummary */ |
|
Definition at line 42 of file qhulldir/io.c. References fout, i, MERGING, qh, qh_ALL, qh_allstatistics(), qh_ASvoronoi, qh_clearcenters(), qh_collectstatistics(), qh_errexit(), qh_ERRqhull, qh_findgood_all(), qh_getarea(), qh_markkeep(), qh_memstatistics(), qh_PRINTEND, qh_printfacets(), qh_PRINTnone, qh_printstatistics(), qh_printstats(), qh_printsummary(), qh_setsize(), qh_vertexneighbors(), qhstat, REALmax, SETelemsize, Zridge, Zridgemid, and zzval_. Referenced by main(), qh_errexit(), and qh_new_qhull().
00042 { 00043 int i, tempsize= qh_setsize ((setT*)qhmem.tempstack), d_1; 00044 00045 if (qh VORONOI) { 00046 qh_clearcenters (qh_ASvoronoi); 00047 qh_vertexneighbors(); 00048 } 00049 if (qh GETarea) 00050 qh_getarea(qh facet_list); 00051 qh_findgood_all (qh facet_list); 00052 if (qh KEEParea || qh KEEPmerge || qh KEEPminArea < REALmax/2) 00053 qh_markkeep (qh facet_list); 00054 if (qh PRINTsummary) 00055 qh_printsummary(qh ferr); 00056 else if (qh PRINTout[0] == qh_PRINTnone) 00057 qh_printsummary(qh fout); 00058 for (i= 0; i < qh_PRINTEND; i++) 00059 qh_printfacets (qh fout, qh PRINTout[i], qh facet_list, NULL, !qh_ALL); 00060 qh_allstatistics(); 00061 if (qh PRINTprecision && !qh MERGING && (qh JOGGLEmax > REALmax/2 || qh RERUN)) 00062 qh_printstats (qh ferr, qhstat precision, NULL); 00063 if (qh VERIFYoutput && (zzval_(Zridge) > 0 || zzval_(Zridgemid) > 0)) 00064 qh_printstats (qh ferr, qhstat vridges, NULL); 00065 if (qh PRINTstatistics) { 00066 qh_collectstatistics(); 00067 qh_printstatistics(qh ferr, ""); 00068 qh_memstatistics (qh ferr); 00069 d_1= sizeof(setT) + (qh hull_dim - 1) * SETelemsize; 00070 fprintf(qh ferr, "\ 00071 size in bytes: merge %d ridge %d vertex %d facet %d\n\ 00072 normal %d ridge vertices %d facet vertices or neighbors %d\n", 00073 sizeof(mergeT), sizeof(ridgeT), 00074 sizeof(vertexT), sizeof(facetT), 00075 qh normal_size, d_1, d_1 + SETelemsize); 00076 } 00077 if (qh_setsize ((setT*)qhmem.tempstack) != tempsize) { 00078 fprintf (qh ferr, "qhull internal error (qh_produce_output): temporary sets not empty (%d)\n", 00079 qh_setsize ((setT*)qhmem.tempstack)); 00080 qh_errexit (qh_ERRqhull, NULL, NULL); 00081 } 00082 } /* produce_output */ |
|
Definition at line 1465 of file geom2.c. References coordT, free, i, malloc, maximize_, num_points, pointT, qh, qh_errexit(), qh_ERRmem, qh_ERRqhull, qh_memalloc(), qh_memfree(), qh_projectpoints(), qh_setdelaunay(), realT, trace0, and trace1.
01465 { 01466 int k,i; 01467 int newdim= qh input_dim, newnum= qh num_points; 01468 signed char *project; 01469 int size= (qh input_dim+1)*sizeof(*project); 01470 pointT *newpoints, *coord, *infinity; 01471 realT paraboloid, maxboloid= 0; 01472 01473 project= (signed char*)qh_memalloc (size); 01474 memset ((char*)project, 0, size); 01475 for (k= 0; k < qh input_dim; k++) { /* skip Delaunay bound */ 01476 if (qh lower_bound[k] == 0 && qh upper_bound[k] == 0) { 01477 project[k]= -1; 01478 newdim--; 01479 } 01480 } 01481 if (qh DELAUNAY) { 01482 project[k]= 1; 01483 newdim++; 01484 if (qh ATinfinity) 01485 newnum++; 01486 } 01487 if (newdim != qh hull_dim) { 01488 fprintf(qh ferr, "qhull internal error (qh_projectinput): dimension after projection %d != hull_dim %d\n", newdim, qh hull_dim); 01489 qh_errexit(qh_ERRqhull, NULL, NULL); 01490 } 01491 if (!(newpoints=(coordT*)malloc(newnum*newdim*sizeof(coordT)))){ 01492 fprintf(qh ferr, "qhull error: insufficient memory to project %d points\n", 01493 qh num_points); 01494 qh_errexit(qh_ERRmem, NULL, NULL); 01495 } 01496 qh_projectpoints (project, qh input_dim+1, qh first_point, 01497 qh num_points, qh input_dim, newpoints, newdim); 01498 trace1((qh ferr, "qh_projectinput: updating lower and upper_bound\n")); 01499 qh_projectpoints (project, qh input_dim+1, qh lower_bound, 01500 1, qh input_dim+1, qh lower_bound, newdim+1); 01501 qh_projectpoints (project, qh input_dim+1, qh upper_bound, 01502 1, qh input_dim+1, qh upper_bound, newdim+1); 01503 if (qh HALFspace) { 01504 if (!qh feasible_point) { 01505 fprintf(qh ferr, "qhull internal error (qh_projectinput): HALFspace defined without qh.feasible_point\n"); 01506 qh_errexit(qh_ERRqhull, NULL, NULL); 01507 } 01508 qh_projectpoints (project, qh input_dim, qh feasible_point, 01509 1, qh input_dim, qh feasible_point, newdim); 01510 } 01511 qh_memfree(project, ((qh input_dim+1)*sizeof(*project))); 01512 if (qh POINTSmalloc) 01513 free (qh first_point); 01514 qh first_point= newpoints; 01515 qh POINTSmalloc= True; 01516 if (qh DELAUNAY && qh ATinfinity) { 01517 coord= qh first_point; 01518 infinity= qh first_point + qh hull_dim * qh num_points; 01519 for (k=qh hull_dim-1; k--; ) 01520 infinity[k]= 0.0; 01521 for (i=qh num_points; i--; ) { 01522 paraboloid= 0.0; 01523 for (k=qh hull_dim-1; k--; ) { 01524 paraboloid += *coord * *coord; 01525 infinity[k] += *coord; 01526 coord++; 01527 } 01528 *(coord++)= paraboloid; 01529 maximize_(maxboloid, paraboloid); 01530 } 01531 /* coord == infinity */ 01532 for (k=qh hull_dim-1; k--; ) 01533 *(coord++) /= qh num_points; 01534 *(coord++)= maxboloid * 1.1; 01535 qh num_points++; 01536 trace0((qh ferr, "qh_projectinput: projected points to paraboloid for Delaunay\n")); 01537 }else if (qh DELAUNAY) /* !qh ATinfinity */ 01538 qh_setdelaunay( qh hull_dim, qh num_points, qh first_point); 01539 } /* projectinput */ |
|
Definition at line 57 of file qhull.c.
00057 { 00058 int numoutside; 00059 00060 qh hulltime= qh_CPUclock; 00061 if (qh RERUN || qh JOGGLEmax < REALmax/2) 00062 qh_build_withrestart(); 00063 else { 00064 qh_initbuild(); 00065 qh_buildhull(); 00066 } 00067 if (!qh STOPpoint && !qh STOPcone) { 00068 if (qh ZEROall_ok && !qh TESTvneighbors && qh MERGEexact) 00069 qh_checkzero( qh_ALL); 00070 if (qh ZEROall_ok && !qh TESTvneighbors && !qh WAScoplanar) { 00071 trace2((qh ferr, "qh_qhull: all facets are clearly convex and no coplanar points. Post-merging and check of maxout not needed.\n")); 00072 }else { 00073 if (qh MERGEexact || (qh hull_dim > qh_DIMreduceBuild && qh PREmerge)) 00074 qh_postmerge ("First post-merge", qh premerge_centrum, qh premerge_cos, 00075 (qh POSTmerge ? False : qh TESTvneighbors)); 00076 else if (!qh POSTmerge && qh TESTvneighbors) 00077 qh_postmerge ("For testing vertex neighbors", qh premerge_centrum, 00078 qh premerge_cos, True); 00079 if (qh POSTmerge) 00080 qh_postmerge ("For post-merging", qh postmerge_centrum, 00081 qh postmerge_cos, qh TESTvneighbors); 00082 if (qh visible_list == qh facet_list) { /* i.e., merging done */ 00083 qh findbestnew= True; 00084 qh_partitionvisible (/*visible_list, newfacet_list*/ !qh_ALL, &numoutside); 00085 qh findbestnew= False; 00086 qh_deletevisible (/*qh visible_list*/); 00087 qh_resetlists (False /*qh visible_list newvertex_list newfacet_list */); 00088 } 00089 if (qh DOcheckmax){ 00090 if (qh REPORTfreq) { 00091 qh_buildtracing (NULL, NULL); 00092 fprintf (qh ferr, "\nTesting all coplanar points.\n"); 00093 } 00094 qh_check_maxout(); 00095 } 00096 } 00097 } 00098 if (qh KEEPnearinside && !qh maxoutdone) 00099 qh_nearcoplanar(); 00100 if (qh_setsize ((setT*)qhmem.tempstack) != 0) { 00101 fprintf (qh ferr, "qhull internal error (qh_qhull): temporary sets not empty (%d)\n", 00102 qh_setsize ((setT*)qhmem.tempstack)); 00103 qh_errexit (qh_ERRqhull, NULL, NULL); 00104 } 00105 qh hulltime= qh_CPUclock - qh hulltime; 00106 qh QHULLfinished= True; 00107 trace1((qh ferr, "qh_qhull: algorithm completed\n")); 00108 } /* qhull */ |
|
Definition at line 1678 of file geom2.c. References i, qh_RANDOMint, qh_RANDOMmax, realT, and rows. Referenced by qh_init_B().
01678 { 01679 int i, k; 01680 realT **rowi, *coord, realr; 01681 01682 coord= buffer; 01683 rowi= rows; 01684 for (i=0; i < dim; i++) { 01685 *(rowi++)= coord; 01686 for (k=0; k < dim; k++) { 01687 realr= qh_RANDOMint; 01688 *(coord++)= 2.0 * realr/(qh_RANDOMmax+1) - 1.0; 01689 } 01690 } 01691 *rowi= coord; 01692 } /* randommatrix */ |
|
Definition at line 3701 of file qhulldir/io.c. References boolT, coordT, firstline, fmin_, free, malloc, maximize_, memcmp(), qh, qh_errexit(), qh_ERRinput, qh_ERRmem, qh_MAXfirst, qh_readfeasible(), qh_REALdigits, qh_setfeasible(), qh_sethalfspace(), qh_strtod(), qh_strtol(), REALmax, realT, and trace1. Referenced by main().
03701 { 03702 coordT *points, *coords, *infinity= NULL; 03703 realT paraboloid, maxboloid= -REALmax, value; 03704 realT *coordp= NULL, *offsetp= NULL, *normalp= NULL; 03705 char *s, *t, firstline[qh_MAXfirst+1]; 03706 int diminput=0, numinput=0, dimfeasible= 0, newnum, k, tempi; 03707 int firsttext=0, firstshort=0, firstlong=0, firstpoint=0; 03708 int tokcount= 0, linecount=0, maxcount, coordcount=0; 03709 boolT islong, isfirst= True, wasbegin= False; 03710 boolT isdelaunay= qh DELAUNAY && !qh PROJECTinput; 03711 03712 if (qh CDDinput) { 03713 while ((s= fgets(firstline, qh_MAXfirst, qh fin))) { 03714 linecount++; 03715 if (qh HALFspace && linecount == 1 && isdigit(*s)) { 03716 dimfeasible= qh_strtol (s, &s); 03717 while (isspace(*s)) 03718 s++; 03719 if (qh_strtol (s, &s) == 1) 03720 linecount += qh_readfeasible (dimfeasible, s); 03721 else 03722 dimfeasible= 0; 03723 }else if (!memcmp (firstline, "begin", 5) || !memcmp (firstline, "BEGIN", 5)) 03724 break; 03725 else if (!*qh rbox_command) 03726 strncat(qh rbox_command, s, sizeof (qh rbox_command)-1); 03727 } 03728 if (!s) { 03729 fprintf (qh ferr, "qhull input error: missing \"begin\" for cdd-formated input\n"); 03730 qh_errexit (qh_ERRinput, NULL, NULL); 03731 } 03732 } 03733 while(!numinput && (s= fgets(firstline, qh_MAXfirst, qh fin))) { 03734 linecount++; 03735 if (!memcmp (s, "begin", 5) || !memcmp (s, "BEGIN", 5)) 03736 wasbegin= True; 03737 while (*s) { 03738 while (isspace(*s)) 03739 s++; 03740 if (!*s) 03741 break; 03742 if (!isdigit(*s)) { 03743 if (!*qh rbox_command) { 03744 strncat(qh rbox_command, s, sizeof (qh rbox_command)-1); 03745 firsttext= linecount; 03746 } 03747 break; 03748 } 03749 if (!diminput) 03750 diminput= qh_strtol (s, &s); 03751 else { 03752 numinput= qh_strtol (s, &s); 03753 if (numinput == 1 && diminput >= 2 && qh HALFspace && !qh CDDinput) { 03754 linecount += qh_readfeasible (diminput, s); /* checks if ok */ 03755 dimfeasible= diminput; 03756 diminput= numinput= 0; 03757 }else 03758 break; 03759 } 03760 } 03761 } 03762 if (!s) { 03763 fprintf(qh ferr, "qhull input error: short input file. Did not find dimension and number of points\n"); 03764 qh_errexit(qh_ERRinput, NULL, NULL); 03765 } 03766 if (diminput > numinput) { 03767 tempi= diminput; /* exchange dim and n, e.g., for cdd input format */ 03768 diminput= numinput; 03769 numinput= tempi; 03770 } 03771 if (diminput < 2) { 03772 fprintf(qh ferr,"qhull input error: dimension %d (first number) should be at least 2\n", 03773 diminput); 03774 qh_errexit(qh_ERRinput, NULL, NULL); 03775 } 03776 if (isdelaunay) { 03777 qh PROJECTdelaunay= False; 03778 if (qh CDDinput) 03779 *dimension= diminput; 03780 else 03781 *dimension= diminput+1; 03782 *numpoints= numinput; 03783 if (qh ATinfinity) 03784 (*numpoints)++; 03785 }else if (qh HALFspace) { 03786 *dimension= diminput - 1; 03787 *numpoints= numinput; 03788 if (diminput < 3) { 03789 fprintf(qh ferr,"qhull input error: dimension %d (first number, includes offset) should be at least 3 for halfspaces\n", 03790 diminput); 03791 qh_errexit(qh_ERRinput, NULL, NULL); 03792 } 03793 if (dimfeasible) { 03794 if (dimfeasible != *dimension) { 03795 fprintf(qh ferr,"qhull input error: dimension %d of feasible point is not one less than dimension %d for halfspaces\n", 03796 dimfeasible, diminput); 03797 qh_errexit(qh_ERRinput, NULL, NULL); 03798 } 03799 }else 03800 qh_setfeasible (*dimension); 03801 }else { 03802 if (qh CDDinput) 03803 *dimension= diminput-1; 03804 else 03805 *dimension= diminput; 03806 *numpoints= numinput; 03807 } 03808 qh normal_size= *dimension * sizeof(coordT); /* for tracing with qh_printpoint */ 03809 if (qh HALFspace) { 03810 qh half_space= coordp= (coordT*) malloc (qh normal_size + sizeof(coordT)); 03811 if (qh CDDinput) { 03812 offsetp= qh half_space; 03813 normalp= offsetp + 1; 03814 }else { 03815 normalp= qh half_space; 03816 offsetp= normalp + *dimension; 03817 } 03818 } 03819 qh maxline= diminput * (qh_REALdigits + 5); 03820 maximize_(qh maxline, 500); 03821 qh line= (char*)malloc ((qh maxline+1) * sizeof (char)); 03822 *ismalloc= True; /* use malloc since memory not setup */ 03823 coords= points= qh temp_malloc= 03824 (coordT*)malloc((*numpoints)*(*dimension)*sizeof(coordT)); 03825 if (!coords || !qh line || (qh HALFspace && !qh half_space)) { 03826 fprintf(qh ferr, "qhull error: insufficient memory to read %d points\n", 03827 numinput); 03828 qh_errexit(qh_ERRmem, NULL, NULL); 03829 } 03830 if (isdelaunay && qh ATinfinity) { 03831 infinity= points + numinput * (*dimension); 03832 for (k= (*dimension) - 1; k--; ) 03833 infinity[k]= 0.0; 03834 } 03835 maxcount= numinput * diminput; 03836 paraboloid= 0.0; 03837 while ((s= (isfirst ? s : fgets(qh line, qh maxline, qh fin)))) { 03838 if (!isfirst) { 03839 linecount++; 03840 if (*s == 'e' || *s == 'E') { 03841 if (!memcmp (s, "end", 3) || !memcmp (s, "END", 3)) { 03842 if (qh CDDinput ) 03843 break; 03844 else if (wasbegin) 03845 fprintf (qh ferr, "qhull input warning: the input appears to be in cdd format. If so, use 'Fd'\n"); 03846 } 03847 } 03848 } 03849 islong= False; 03850 while (*s) { 03851 while (isspace(*s)) 03852 s++; 03853 value= qh_strtod (s, &t); 03854 if (s == t) { 03855 if (!*qh rbox_command) 03856 strncat(qh rbox_command, s, sizeof (qh rbox_command)-1); 03857 if (*s && !firsttext) 03858 firsttext= linecount; 03859 if (!islong && !firstshort && coordcount) 03860 firstshort= linecount; 03861 break; 03862 } 03863 if (!firstpoint) 03864 firstpoint= linecount; 03865 s= t; 03866 if (++tokcount > maxcount) 03867 continue; 03868 if (qh HALFspace) { 03869 if (qh CDDinput && !coordcount) 03870 *(coordp++)= -value; /* offset */ 03871 else 03872 *(coordp++)= value; 03873 }else { 03874 *(coords++)= value; 03875 if (qh CDDinput && !coordcount) { 03876 if (value != 1.0) { 03877 fprintf (qh ferr, "qhull input error: for cdd format, point at line %d does not start with '1'\n", 03878 linecount); 03879 qh_errexit (qh_ERRinput, NULL, NULL); 03880 } 03881 coords--; 03882 }else if (isdelaunay) { 03883 paraboloid += value * value; 03884 if (qh ATinfinity) { 03885 if (qh CDDinput) 03886 infinity[coordcount-1] += value; 03887 else 03888 infinity[coordcount] += value; 03889 } 03890 } 03891 } 03892 if (++coordcount == diminput) { 03893 coordcount= 0; 03894 if (isdelaunay) { 03895 *(coords++)= paraboloid; 03896 maximize_(maxboloid, paraboloid); 03897 paraboloid= 0.0; 03898 }else if (qh HALFspace) { 03899 if (!qh_sethalfspace (*dimension, coords, &coords, normalp, offsetp, qh feasible_point)) { 03900 fprintf (qh ferr, "The halfspace was on line %d\n", linecount); 03901 if (wasbegin) 03902 fprintf (qh ferr, "The input appears to be in cdd format. If so, you should use option 'Fd'\n"); 03903 qh_errexit (qh_ERRinput, NULL, NULL); 03904 } 03905 coordp= qh half_space; 03906 } 03907 while (isspace(*s)) 03908 s++; 03909 if (*s) { 03910 islong= True; 03911 if (!firstlong) 03912 firstlong= linecount; 03913 } 03914 } 03915 } 03916 if (!islong && !firstshort && coordcount) 03917 firstshort= linecount; 03918 if (!isfirst && s - qh line >= qh maxline) { 03919 fprintf(qh ferr, "qhull input error: line %d contained more than %d characters\n", 03920 linecount, (int) (s - qh line)); 03921 qh_errexit(qh_ERRinput, NULL, NULL); 03922 } 03923 isfirst= False; 03924 } 03925 if (tokcount != maxcount) { 03926 newnum= fmin_(numinput, tokcount/diminput); 03927 fprintf(qh ferr,"\ 03928 qhull warning: instead of %d %d-dimensional points, input contains\n\ 03929 %d points and %d extra coordinates. Line %d is the first\npoint", 03930 numinput, diminput, tokcount/diminput, tokcount % diminput, firstpoint); 03931 if (firsttext) 03932 fprintf(qh ferr, ", line %d is the first comment", firsttext); 03933 if (firstshort) 03934 fprintf(qh ferr, ", line %d is the first short\nline", firstshort); 03935 if (firstlong) 03936 fprintf(qh ferr, ", line %d is the first long line", firstlong); 03937 fprintf(qh ferr, ". Continue with %d points.\n", newnum); 03938 numinput= newnum; 03939 if (isdelaunay && qh ATinfinity) { 03940 for (k= tokcount % diminput; k--; ) 03941 infinity[k] -= *(--coords); 03942 *numpoints= newnum+1; 03943 }else { 03944 coords -= tokcount % diminput; 03945 *numpoints= newnum; 03946 } 03947 } 03948 if (isdelaunay && qh ATinfinity) { 03949 for (k= (*dimension) -1; k--; ) 03950 infinity[k] /= numinput; 03951 if (coords == infinity) 03952 coords += (*dimension) -1; 03953 else { 03954 for (k= 0; k < (*dimension) -1; k++) 03955 *(coords++)= infinity[k]; 03956 } 03957 *(coords++)= maxboloid * 1.1; 03958 } 03959 if (qh rbox_command[0]) { 03960 qh rbox_command[strlen(qh rbox_command)-1]= '\0'; 03961 if (!strcmp (qh rbox_command, "./rbox D4")) 03962 fprintf (qh ferr, "\n\ 03963 This is the qhull test case. If any errors or core dumps occur,\n\ 03964 recompile qhull with 'make new'. If errors still occur, there is\n\ 03965 an incompatibility. You should try a different compiler. You can also\n\ 03966 change the choices in user.h. If you discover the source of the problem,\n\ 03967 please send mail to qhull_bug@geom.umn.edu.\n\ 03968 \n\ 03969 Type 'qhull' for a short list of options.\n"); 03970 } 03971 free (qh line); 03972 qh line= NULL; 03973 if (qh half_space) { 03974 free (qh half_space); 03975 qh half_space= NULL; 03976 } 03977 qh temp_malloc= NULL; 03978 trace1((qh ferr,"qh_readpoints: read in %d %d-dimensional points\n", 03979 numinput, diminput)); 03980 return(points); 03981 } /* readpoints */ |
|
Definition at line 1711 of file geom2.c. References num_points, qh, qh_copypoints(), qh_rotatepoints(), realT, and rows. Referenced by qh_init_B().
01711 { 01712 01713 if (!qh POINTSmalloc) { 01714 qh first_point= qh_copypoints (qh first_point, qh num_points, qh hull_dim); 01715 qh POINTSmalloc= True; 01716 } 01717 qh_rotatepoints (qh first_point, qh num_points, qh hull_dim, rows); 01718 } /* rotateinput */ |
|
Definition at line 1773 of file geom2.c. References num_points, qh, qh_copypoints(), and qh_scalepoints().
01773 { 01774 01775 if (!qh POINTSmalloc) { 01776 qh first_point= qh_copypoints (qh first_point, qh num_points, qh hull_dim); 01777 qh POINTSmalloc= True; 01778 } 01779 qh_scalepoints (qh first_point, qh num_points, qh hull_dim, 01780 qh lower_bound, qh upper_bound); 01781 } /* scaleinput */ |
|
Definition at line 1933 of file geom2.c. References coordT, i, pointT, qh, qh_scalelast(), REALmax, realT, and trace0. Referenced by qh_joggleinput(), and qh_projectinput().
01933 { 01934 int i, k; 01935 coordT *coordp, coord; 01936 realT paraboloid; 01937 01938 trace0((qh ferr, "qh_setdelaunay: project %d points to paraboloid for Delaunay triangulation\n", count)); 01939 coordp= points; 01940 for (i= 0; i < count; i++) { 01941 coord= *coordp++; 01942 paraboloid= coord*coord; 01943 for (k= dim-2; k--; ) { 01944 coord= *coordp++; 01945 paraboloid += coord*coord; 01946 } 01947 *coordp++ = paraboloid; 01948 } 01949 if (qh last_low < REALmax/2) 01950 qh_scalelast (points, count, dim, qh last_low, qh last_high, qh last_newhigh); 01951 } /* setdelaunay */ |
|
Definition at line 2042 of file geom2.c. References coordT, i, malloc, pointT, qh, qh_errexit(), qh_ERRinput, qh_ERRmem, qh_sethalfspace(), and trace0. Referenced by qh_new_qhull().
02042 { 02043 int i, newdim; 02044 pointT *newpoints; 02045 coordT *coordp, *normalp, *offsetp; 02046 02047 trace0((qh ferr, "qh_sethalfspace_all: compute dual for halfspace intersection\n")); 02048 newdim= dim - 1; 02049 if (!(newpoints=(coordT*)malloc(count*newdim*sizeof(coordT)))){ 02050 fprintf(qh ferr, "qhull error: insufficient memory to compute dual of %d halfspaces\n", 02051 count); 02052 qh_errexit(qh_ERRmem, NULL, NULL); 02053 } 02054 coordp= newpoints; 02055 normalp= halfspaces; 02056 for (i= 0; i < count; i++) { 02057 offsetp= normalp + newdim; 02058 if (!qh_sethalfspace (newdim, coordp, &coordp, normalp, offsetp, feasible)) { 02059 fprintf (qh ferr, "The halfspace was at index %d\n", i); 02060 qh_errexit (qh_ERRinput, NULL, NULL); 02061 } 02062 normalp= offsetp + 1; 02063 } 02064 return newpoints; 02065 } /* sethalfspace_all */ |
|
Definition at line 2517 of file poly2.c. References facetT::center, FORALLfacets, facetT::normal, qh, qh_ASvoronoi, qh_clearcenters(), qh_facetcenter(), qh_vertexneighbors(), facetT::upperdelaunay, and facetT::vertices.
02517 { 02518 facetT *facet; 02519 02520 qh_clearcenters (qh_ASvoronoi); 02521 qh_vertexneighbors(); 02522 02523 FORALLfacets { 02524 if (!facet->normal || !facet->upperdelaunay || qh UPPERdelaunay) { 02525 if (!facet->center) 02526 facet->center= qh_facetcenter (facet->vertices); 02527 } 02528 } 02529 } /* setvoronoi_all */ |
|
Definition at line 323 of file user.c. Referenced by qh_initqhull_mem().
00323 { 00324 00325 /* qh_memsize (size); */ 00326 } /* user_memsizes */ |
Variable Documentation
|
|
|
Definition at line 352 of file qhull.h. Referenced by main(). |