1 | /*<html><pre> -<a href="qh-poly.htm"
|
---|
2 | >-------------------------------</a><a name="TOP">-</a>
|
---|
3 |
|
---|
4 | poly.h
|
---|
5 | header file for poly.c and poly2.c
|
---|
6 |
|
---|
7 | see qh-poly.htm, libqhull.h and poly.c
|
---|
8 |
|
---|
9 | Copyright (c) 1993-2012 The Geometry Center.
|
---|
10 | $Id: //main/2011/qhull/src/libqhull/poly.h#3 $$Change: 1464 $
|
---|
11 | $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
|
---|
12 | */
|
---|
13 |
|
---|
14 | #ifndef qhDEFpoly
|
---|
15 | #define qhDEFpoly 1
|
---|
16 |
|
---|
17 | #include "libqhull.h"
|
---|
18 |
|
---|
19 | /*=============== constants ========================== */
|
---|
20 |
|
---|
21 | /*-<a href="qh-geom.htm#TOC"
|
---|
22 | >--------------------------------</a><a name="ALGORITHMfault">-</a>
|
---|
23 |
|
---|
24 | ALGORITHMfault
|
---|
25 | use as argument to checkconvex() to report errors during buildhull
|
---|
26 | */
|
---|
27 | #define qh_ALGORITHMfault 0
|
---|
28 |
|
---|
29 | /*-<a href="qh-poly.htm#TOC"
|
---|
30 | >--------------------------------</a><a name="DATAfault">-</a>
|
---|
31 |
|
---|
32 | DATAfault
|
---|
33 | use as argument to checkconvex() to report errors during initialhull
|
---|
34 | */
|
---|
35 | #define qh_DATAfault 1
|
---|
36 |
|
---|
37 | /*-<a href="qh-poly.htm#TOC"
|
---|
38 | >--------------------------------</a><a name="DUPLICATEridge">-</a>
|
---|
39 |
|
---|
40 | DUPLICATEridge
|
---|
41 | special value for facet->neighbor to indicate a duplicate ridge
|
---|
42 |
|
---|
43 | notes:
|
---|
44 | set by matchneighbor, used by matchmatch and mark_dupridge
|
---|
45 | */
|
---|
46 | #define qh_DUPLICATEridge (facetT *)1L
|
---|
47 |
|
---|
48 | /*-<a href="qh-poly.htm#TOC"
|
---|
49 | >--------------------------------</a><a name="MERGEridge">-</a>
|
---|
50 |
|
---|
51 | MERGEridge flag in facet
|
---|
52 | special value for facet->neighbor to indicate a merged ridge
|
---|
53 |
|
---|
54 | notes:
|
---|
55 | set by matchneighbor, used by matchmatch and mark_dupridge
|
---|
56 | */
|
---|
57 | #define qh_MERGEridge (facetT *)2L
|
---|
58 |
|
---|
59 |
|
---|
60 | /*============ -structures- ====================*/
|
---|
61 |
|
---|
62 | /*=========== -macros- =========================*/
|
---|
63 |
|
---|
64 | /*-<a href="qh-poly.htm#TOC"
|
---|
65 | >--------------------------------</a><a name="FORALLfacet_">-</a>
|
---|
66 |
|
---|
67 | FORALLfacet_( facetlist ) { ... }
|
---|
68 | assign 'facet' to each facet in facetlist
|
---|
69 |
|
---|
70 | notes:
|
---|
71 | uses 'facetT *facet;'
|
---|
72 | assumes last facet is a sentinel
|
---|
73 |
|
---|
74 | see:
|
---|
75 | FORALLfacets
|
---|
76 | */
|
---|
77 | #define FORALLfacet_( facetlist ) if (facetlist ) for ( facet=( facetlist ); facet && facet->next; facet= facet->next )
|
---|
78 |
|
---|
79 | /*-<a href="qh-poly.htm#TOC"
|
---|
80 | >--------------------------------</a><a name="FORALLnew_facets">-</a>
|
---|
81 |
|
---|
82 | FORALLnew_facets { ... }
|
---|
83 | assign 'newfacet' to each facet in qh.newfacet_list
|
---|
84 |
|
---|
85 | notes:
|
---|
86 | uses 'facetT *newfacet;'
|
---|
87 | at exit, newfacet==NULL
|
---|
88 | */
|
---|
89 | #define FORALLnew_facets for ( newfacet=qh newfacet_list;newfacet && newfacet->next;newfacet=newfacet->next )
|
---|
90 |
|
---|
91 | /*-<a href="qh-poly.htm#TOC"
|
---|
92 | >--------------------------------</a><a name="FORALLvertex_">-</a>
|
---|
93 |
|
---|
94 | FORALLvertex_( vertexlist ) { ... }
|
---|
95 | assign 'vertex' to each vertex in vertexlist
|
---|
96 |
|
---|
97 | notes:
|
---|
98 | uses 'vertexT *vertex;'
|
---|
99 | at exit, vertex==NULL
|
---|
100 | */
|
---|
101 | #define FORALLvertex_( vertexlist ) for (vertex=( vertexlist );vertex && vertex->next;vertex= vertex->next )
|
---|
102 |
|
---|
103 | /*-<a href="qh-poly.htm#TOC"
|
---|
104 | >--------------------------------</a><a name="FORALLvisible_facets">-</a>
|
---|
105 |
|
---|
106 | FORALLvisible_facets { ... }
|
---|
107 | assign 'visible' to each visible facet in qh.visible_list
|
---|
108 |
|
---|
109 | notes:
|
---|
110 | uses 'vacetT *visible;'
|
---|
111 | at exit, visible==NULL
|
---|
112 | */
|
---|
113 | #define FORALLvisible_facets for (visible=qh visible_list; visible && visible->visible; visible= visible->next)
|
---|
114 |
|
---|
115 | /*-<a href="qh-poly.htm#TOC"
|
---|
116 | >--------------------------------</a><a name="FORALLsame_">-</a>
|
---|
117 |
|
---|
118 | FORALLsame_( newfacet ) { ... }
|
---|
119 | assign 'same' to each facet in newfacet->f.samecycle
|
---|
120 |
|
---|
121 | notes:
|
---|
122 | uses 'facetT *same;'
|
---|
123 | stops when it returns to newfacet
|
---|
124 | */
|
---|
125 | #define FORALLsame_(newfacet) for (same= newfacet->f.samecycle; same != newfacet; same= same->f.samecycle)
|
---|
126 |
|
---|
127 | /*-<a href="qh-poly.htm#TOC"
|
---|
128 | >--------------------------------</a><a name="FORALLsame_cycle_">-</a>
|
---|
129 |
|
---|
130 | FORALLsame_cycle_( newfacet ) { ... }
|
---|
131 | assign 'same' to each facet in newfacet->f.samecycle
|
---|
132 |
|
---|
133 | notes:
|
---|
134 | uses 'facetT *same;'
|
---|
135 | at exit, same == NULL
|
---|
136 | */
|
---|
137 | #define FORALLsame_cycle_(newfacet) \
|
---|
138 | for (same= newfacet->f.samecycle; \
|
---|
139 | same; same= (same == newfacet ? NULL : same->f.samecycle))
|
---|
140 |
|
---|
141 | /*-<a href="qh-poly.htm#TOC"
|
---|
142 | >--------------------------------</a><a name="FOREACHneighborA_">-</a>
|
---|
143 |
|
---|
144 | FOREACHneighborA_( facet ) { ... }
|
---|
145 | assign 'neighborA' to each neighbor in facet->neighbors
|
---|
146 |
|
---|
147 | FOREACHneighborA_( vertex ) { ... }
|
---|
148 | assign 'neighborA' to each neighbor in vertex->neighbors
|
---|
149 |
|
---|
150 | declare:
|
---|
151 | facetT *neighborA, **neighborAp;
|
---|
152 |
|
---|
153 | see:
|
---|
154 | <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
155 | */
|
---|
156 | #define FOREACHneighborA_(facet) FOREACHsetelement_(facetT, facet->neighbors, neighborA)
|
---|
157 |
|
---|
158 | /*-<a href="qh-poly.htm#TOC"
|
---|
159 | >--------------------------------</a><a name="FOREACHvisible_">-</a>
|
---|
160 |
|
---|
161 | FOREACHvisible_( facets ) { ... }
|
---|
162 | assign 'visible' to each facet in facets
|
---|
163 |
|
---|
164 | notes:
|
---|
165 | uses 'facetT *facet, *facetp;'
|
---|
166 | see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
167 | */
|
---|
168 | #define FOREACHvisible_(facets) FOREACHsetelement_(facetT, facets, visible)
|
---|
169 |
|
---|
170 | /*-<a href="qh-poly.htm#TOC"
|
---|
171 | >--------------------------------</a><a name="FOREACHnewfacet_">-</a>
|
---|
172 |
|
---|
173 | FOREACHnewfacet_( facets ) { ... }
|
---|
174 | assign 'newfacet' to each facet in facets
|
---|
175 |
|
---|
176 | notes:
|
---|
177 | uses 'facetT *newfacet, *newfacetp;'
|
---|
178 | see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
179 | */
|
---|
180 | #define FOREACHnewfacet_(facets) FOREACHsetelement_(facetT, facets, newfacet)
|
---|
181 |
|
---|
182 | /*-<a href="qh-poly.htm#TOC"
|
---|
183 | >--------------------------------</a><a name="FOREACHvertexA_">-</a>
|
---|
184 |
|
---|
185 | FOREACHvertexA_( vertices ) { ... }
|
---|
186 | assign 'vertexA' to each vertex in vertices
|
---|
187 |
|
---|
188 | notes:
|
---|
189 | uses 'vertexT *vertexA, *vertexAp;'
|
---|
190 | see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
191 | */
|
---|
192 | #define FOREACHvertexA_(vertices) FOREACHsetelement_(vertexT, vertices, vertexA)
|
---|
193 |
|
---|
194 | /*-<a href="qh-poly.htm#TOC"
|
---|
195 | >--------------------------------</a><a name="FOREACHvertexreverse12_">-</a>
|
---|
196 |
|
---|
197 | FOREACHvertexreverse12_( vertices ) { ... }
|
---|
198 | assign 'vertex' to each vertex in vertices
|
---|
199 | reverse order of first two vertices
|
---|
200 |
|
---|
201 | notes:
|
---|
202 | uses 'vertexT *vertex, *vertexp;'
|
---|
203 | see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
204 | */
|
---|
205 | #define FOREACHvertexreverse12_(vertices) FOREACHsetelementreverse12_(vertexT, vertices, vertex)
|
---|
206 |
|
---|
207 |
|
---|
208 | /*=============== prototypes poly.c in alphabetical order ================*/
|
---|
209 |
|
---|
210 | void qh_appendfacet(facetT *facet);
|
---|
211 | void qh_appendvertex(vertexT *vertex);
|
---|
212 | void qh_attachnewfacets(void);
|
---|
213 | boolT qh_checkflipped(facetT *facet, realT *dist, boolT allerror);
|
---|
214 | void qh_delfacet(facetT *facet);
|
---|
215 | void qh_deletevisible(void /*qh visible_list, qh horizon_list*/);
|
---|
216 | setT *qh_facetintersect(facetT *facetA, facetT *facetB, int *skipAp,int *skipBp, int extra);
|
---|
217 | int qh_gethash(int hashsize, setT *set, int size, int firstindex, void *skipelem);
|
---|
218 | facetT *qh_makenewfacet(setT *vertices, boolT toporient, facetT *facet);
|
---|
219 | void qh_makenewplanes(void /* newfacet_list */);
|
---|
220 | facetT *qh_makenew_nonsimplicial(facetT *visible, vertexT *apex, int *numnew);
|
---|
221 | facetT *qh_makenew_simplicial(facetT *visible, vertexT *apex, int *numnew);
|
---|
222 | void qh_matchneighbor(facetT *newfacet, int newskip, int hashsize,
|
---|
223 | int *hashcount);
|
---|
224 | void qh_matchnewfacets(void);
|
---|
225 | boolT qh_matchvertices(int firstindex, setT *verticesA, int skipA,
|
---|
226 | setT *verticesB, int *skipB, boolT *same);
|
---|
227 | facetT *qh_newfacet(void);
|
---|
228 | ridgeT *qh_newridge(void);
|
---|
229 | int qh_pointid(pointT *point);
|
---|
230 | void qh_removefacet(facetT *facet);
|
---|
231 | void qh_removevertex(vertexT *vertex);
|
---|
232 | void qh_updatevertices(void);
|
---|
233 |
|
---|
234 |
|
---|
235 | /*========== -prototypes poly2.c in alphabetical order ===========*/
|
---|
236 |
|
---|
237 | void qh_addhash(void* newelem, setT *hashtable, int hashsize, int hash);
|
---|
238 | void qh_check_bestdist(void);
|
---|
239 | void qh_check_maxout(void);
|
---|
240 | void qh_check_output(void);
|
---|
241 | void qh_check_point(pointT *point, facetT *facet, realT *maxoutside, realT *maxdist, facetT **errfacet1, facetT **errfacet2);
|
---|
242 | void qh_check_points(void);
|
---|
243 | void qh_checkconvex(facetT *facetlist, int fault);
|
---|
244 | void qh_checkfacet(facetT *facet, boolT newmerge, boolT *waserrorp);
|
---|
245 | void qh_checkflipped_all(facetT *facetlist);
|
---|
246 | void qh_checkpolygon(facetT *facetlist);
|
---|
247 | void qh_checkvertex(vertexT *vertex);
|
---|
248 | void qh_clearcenters(qh_CENTER type);
|
---|
249 | void qh_createsimplex(setT *vertices);
|
---|
250 | void qh_delridge(ridgeT *ridge);
|
---|
251 | void qh_delvertex(vertexT *vertex);
|
---|
252 | setT *qh_facet3vertex(facetT *facet);
|
---|
253 | facetT *qh_findbestfacet(pointT *point, boolT bestoutside,
|
---|
254 | realT *bestdist, boolT *isoutside);
|
---|
255 | facetT *qh_findbestlower(facetT *upperfacet, pointT *point, realT *bestdistp, int *numpart);
|
---|
256 | facetT *qh_findfacet_all(pointT *point, realT *bestdist, boolT *isoutside,
|
---|
257 | int *numpart);
|
---|
258 | int qh_findgood(facetT *facetlist, int goodhorizon);
|
---|
259 | void qh_findgood_all(facetT *facetlist);
|
---|
260 | void qh_furthestnext(void /* qh facet_list */);
|
---|
261 | void qh_furthestout(facetT *facet);
|
---|
262 | void qh_infiniteloop(facetT *facet);
|
---|
263 | void qh_initbuild(void);
|
---|
264 | void qh_initialhull(setT *vertices);
|
---|
265 | setT *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints);
|
---|
266 | vertexT *qh_isvertex(pointT *point, setT *vertices);
|
---|
267 | vertexT *qh_makenewfacets(pointT *point /*horizon_list, visible_list*/);
|
---|
268 | void qh_matchduplicates(facetT *atfacet, int atskip, int hashsize, int *hashcount);
|
---|
269 | void qh_nearcoplanar(void /* qh.facet_list */);
|
---|
270 | vertexT *qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp);
|
---|
271 | int qh_newhashtable(int newsize);
|
---|
272 | vertexT *qh_newvertex(pointT *point);
|
---|
273 | ridgeT *qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp);
|
---|
274 | void qh_outcoplanar(void /* facet_list */);
|
---|
275 | pointT *qh_point(int id);
|
---|
276 | void qh_point_add(setT *set, pointT *point, void *elem);
|
---|
277 | setT *qh_pointfacet(void /*qh facet_list*/);
|
---|
278 | setT *qh_pointvertex(void /*qh facet_list*/);
|
---|
279 | void qh_prependfacet(facetT *facet, facetT **facetlist);
|
---|
280 | void qh_printhashtable(FILE *fp);
|
---|
281 | void qh_printlists(void);
|
---|
282 | void qh_resetlists(boolT stats, boolT resetVisible /*qh newvertex_list newfacet_list visible_list*/);
|
---|
283 | void qh_setvoronoi_all(void);
|
---|
284 | void qh_triangulate(void /*qh facet_list*/);
|
---|
285 | void qh_triangulate_facet(facetT *facetA, vertexT **first_vertex);
|
---|
286 | void qh_triangulate_link(facetT *oldfacetA, facetT *facetA, facetT *oldfacetB, facetT *facetB);
|
---|
287 | void qh_triangulate_mirror(facetT *facetA, facetT *facetB);
|
---|
288 | void qh_triangulate_null(facetT *facetA);
|
---|
289 | void qh_vertexintersect(setT **vertexsetA,setT *vertexsetB);
|
---|
290 | setT *qh_vertexintersect_new(setT *vertexsetA,setT *vertexsetB);
|
---|
291 | void qh_vertexneighbors(void /*qh facet_list*/);
|
---|
292 | boolT qh_vertexsubset(setT *vertexsetA, setT *vertexsetB);
|
---|
293 |
|
---|
294 |
|
---|
295 | #endif /* qhDEFpoly */
|
---|