📄 qhull.h
字号:
setT *del_vertices; /* vertices to partition and delete with visible facets. Have deleted set for checkfacet */ /* -buffers */ coordT *gm_matrix; /* (dim+1)Xdim matrix for geom.c */ coordT **gm_row; /* array of gm_matrix rows */ char* line; /* malloc'd input line of maxline+1 chars */ int maxline; coordT *half_space; /* malloc'd input array for halfspace (qh normal_size+coordT) */ coordT *temp_malloc; /* malloc'd input array for points */ /* -statics */ boolT ERREXITcalled; /* true during errexit (prevents duplicate calls */ boolT firstcentrum; /* for qh_printcentrum */ int lastreport; /* for qh_buildtracing */ int mergereport; /* for qh_tracemerging */ boolT old_randomdist; /* save in io.c for RANDOMdist */ int ridgeoutnum; /* number of ridges in 4OFF output */ void *old_qhstat; /* for saving qh_qhstat in save_qhull() */ setT *old_tempstack; /* for saving qhmem.tempstack in save_qhull */ setT *searchset; /* set of facets for searching in qh_findbest() */ int rand_seed; /* for qh_rand/qh_srand */};/* =========== -macros- ========================= -otherfacet_(ridge, facet) return neighboring facet for a ridge in facet-getid_(p) return id or -1 if NULL*/#define otherfacet_(ridge, facet) \ (((ridge)->top == (facet)) ? (ridge)->bottom : (ridge)->top)#define getid_(p) ((p) ? (p)->id : -1)/* ----------------------------------------------FORALL and FOREACH macros These all iterate using a variable of the same name, e.g. FORALLfacets and FOREACHfacet_ uses 'facet' declared by 'facetT *facet'. The macros may use auxiliary variables as indicated.-FORALLfacets iterate over all facets in facetlist -FORALLpoint_(points, num) iterate over num points (uses 'pointT *pointtemp')-FORALLvertices iterate over all vertices in vertex_list-FOREACHfacet_(facets) iterate over facet set (uses 'facetT **facetp')-FOREACHneighbor_(facet) iterate over facet->neighbors (uses 'facetT **neighborp')-FOREACHpoint_(points) iterate over point set (uses 'pointT **pointp')-FOREACHridge_(ridges) iterate over ridge set (uses 'ridgeT **ridgep')-FOREACHvertex_(vertice) iterate over vertex set (uses 'vertexT **vertexp')-FOREACHadjacent_(vertex) iterate over adjacent vertices to vertex -FOREACHneighbor_(vertex) iterate over neighboring facets to vertex -FOREACHfacet_i_(facets) iterate over facets by facet_i and facet_n-FOREACHneighbor_i_(facet) iterate over facet->neighbors by neighbor_i, neighbor_n-FOREACHvertex_i_(vertices) iterate over vertices by vertex_i, vertex_n-FOREACHpoint_i_(points) iterate over points by point_i, point_n-FOREACHridge_i_(ridges) iterate over ridges by ridge_i, ridge_n-FOREACHneighbor_i_(vertex) iterate over vertex->neighbors by neighbor_i, neighbor_n WARNING: nested loops can't use the same variable (define another FOREACH) WARNING: strange behavior if don't fully brace when nested (including intervening blocks, e.g. FOREACH...{ if () FOREACH...} ) poly.h defines other FOREACH/FORALL macros set.h defines FOREACHsetelement and contains additional notes*/#define FORALLfacets for (facet=qh facet_list;facet && facet->next;facet=facet->next)#define FORALLpoints FORALLpoint_(qh first_point, qh num_points)#define FORALLvertices for (vertex=qh vertex_list;vertex && vertex->next;vertex= vertex->next)#define FORALLpoint_(points, num) for(point= (points), \ pointtemp= (points)+qh hull_dim*(num); point < pointtemp; point += qh hull_dim)#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)/* ======= -functions =========== see corresponding .c file for definitions Qhull functions (see qhull.c and qhull_a.h)-qhull construct the convex hull of a set of points-addpoint add point to hull (must be above facet)-printsummary print summary about the output User redefinable functions (see user.c)-errexit return exitcode to system after an error-errprint print erroneous facets, ridge, and vertex-printfacetlist print all fields for a list of facets-user_memsizes define up to 10 additional quick allocation sizes Geometric functions (see geom.c and geom.h for other useful functions)-gram_schmidt implements Gram-Schmidt orthogonalization by rows-projectinput project input along one or more dimensions + Delaunay projection-randommatrix generate a random dimXdim matrix in range (-1,1)-rotatepoints rotate numpoints points by a row matrix-scaleinput scale input to new lowbound and highbound-sethalfspace_all generate dual for halfspace intersection with feasible point Global init/free functions (see global.c and qhull_a.h)-freeqhull free memory used by qhull-init_A called before error handling initialized-init_B called after points are defined-initflags set flags and initialized constants from command line-restore_qhull restores a saved qhull-save_qhull saves qhull for later restoring Input/output functions (see io.c and io.h)-dfacet print facet by id-dvertex print vertex by id-printsummary print summary about the output-produce_output prints out the result of qhull in desired format-readpoints read points from input Polyhedron functions (see poly.c or poly2.c)-check_output check output data structure according to user flags-check_points verify that all points are inside the hull-setvoronoi_all compute Voronoi centers for all facets-findfacet find facet that is furthest below a point -nearvertex return nearest vertex to point-point return point for a point id, or NULL if unknown-pointid return id for a point, or -1 if not known-facetvertices returns temporary set of vertices in a set of facets-pointfacet return temporary set of facets indexed by point id-pointvertex return temporary set of vertices indexed by point id Statistics functions (see stat.c)-printallstatistics print all statistics other functions no longer needed by most users-init_qhull_command build qhull_command from argc/argv-initqhull_buffers initialize global memory buffers-initqhull_globals initialize globals-initqhull_mem initialize mem.c for qhull-initqhull_start start initialization of qhull-initthresholds set thresholds for printing and scaling from command line-findbest find visible facet for a point starting at a facet-findbestnew find best newfacet for point*//********* -qhull.c prototypes (duplicated from qhull_a.h) **********************/void qh_qhull (void);boolT qh_addpoint (pointT *furthest, facetT *facet, boolT checkdist);void qh_printsummary(FILE *fp);/********* -user.c prototypes (alphabetical) **********************/void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge);void qh_errprint(char* string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex);void qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall);void qh_user_memsizes (void);/***** -geom.c/geom2.c prototypes (duplicated from geom.h) ****************/facetT *qh_findbest (pointT *point, facetT *facet, boolT bestoutside, boolT newfacets, 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_printsummary(FILE *fp);void qh_projectinput (void);void qh_randommatrix (realT *buffer, int dim, realT **row);void qh_rotateinput (realT **rows);void qh_scaleinput (void);coordT *qh_sethalfspace_all (int dim, int count, coordT *halfspaces, pointT *feasible);/***** -global.c prototypes (alphabetical) ***********************/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);#if qh_QHpointervoid qh_restore_qhull (qhT **oldqh);qhT *qh_save_qhull (void);#endif/***** -io.c prototypes (duplicated from io.h) ***********************/void dfacet( int id);void dvertex( int id);void qh_produce_output(void);coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc);/********* -mem.c prototypes (duplicated from mem.h) **********************/void qh_meminit (FILE *ferr);void qh_memfreeshort (int *curlong, int *totlong);/********* -poly.c/poly2.c prototypes (duplicated from poly.h) **********************/void qh_check_output (void);void qh_check_points (void);setT *qh_facetvertices (facetT *facetlist, setT *facets, boolT allfacets);facetT *qh_findfacet (pointT *point, facetT *facet, realT *dist, boolT *isoutside, int *numpart);vertexT *qh_nearvertex (facetT *facet, pointT *point, realT *bestdistp);pointT *qh_point (int id);setT *qh_pointfacet (void /*qh.facet_list*/);int qh_pointid (pointT *point);setT *qh_pointvertex (void /*qh.facet_list*/);void qh_setvoronoi_all (void);/********* -stat.c prototypes (duplicated from stat.h) **********************/void qh_printallstatistics (FILE *fp, char *string);#endif /* qhDEFqhull */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -