ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/QuickHull/poly.h
Revision: 1138
Committed: Tue May 29 22:51:00 2007 UTC (17 years, 11 months ago) by chuckv
Content type: text/plain
File size: 10826 byte(s)
Log Message:
Addded QuickHull to cvs.

File Contents

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