1 | /*<html><pre> -<a href="qh-merge.htm"
|
---|
2 | >-------------------------------</a><a name="TOP">-</a>
|
---|
3 |
|
---|
4 | merge.h
|
---|
5 | header file for merge.c
|
---|
6 |
|
---|
7 | see qh-merge.htm and merge.c
|
---|
8 |
|
---|
9 | Copyright (c) 1993-2012 C.B. Barber.
|
---|
10 | $Id: //main/2011/qhull/src/libqhull/merge.h#3 $$Change: 1464 $
|
---|
11 | $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
|
---|
12 | */
|
---|
13 |
|
---|
14 | #ifndef qhDEFmerge
|
---|
15 | #define qhDEFmerge 1
|
---|
16 |
|
---|
17 | #include "libqhull.h"
|
---|
18 |
|
---|
19 |
|
---|
20 | /*============ -constants- ==============*/
|
---|
21 |
|
---|
22 | /*-<a href="qh-merge.htm#TOC"
|
---|
23 | >--------------------------------</a><a name="qh_ANGLEredundant">-</a>
|
---|
24 |
|
---|
25 | qh_ANGLEredundant
|
---|
26 | indicates redundant merge in mergeT->angle
|
---|
27 | */
|
---|
28 | #define qh_ANGLEredundant 6.0
|
---|
29 |
|
---|
30 | /*-<a href="qh-merge.htm#TOC"
|
---|
31 | >--------------------------------</a><a name="qh_ANGLEdegen">-</a>
|
---|
32 |
|
---|
33 | qh_ANGLEdegen
|
---|
34 | indicates degenerate facet in mergeT->angle
|
---|
35 | */
|
---|
36 | #define qh_ANGLEdegen 5.0
|
---|
37 |
|
---|
38 | /*-<a href="qh-merge.htm#TOC"
|
---|
39 | >--------------------------------</a><a name="qh_ANGLEconcave">-</a>
|
---|
40 |
|
---|
41 | qh_ANGLEconcave
|
---|
42 | offset to indicate concave facets in mergeT->angle
|
---|
43 |
|
---|
44 | notes:
|
---|
45 | concave facets are assigned the range of [2,4] in mergeT->angle
|
---|
46 | roundoff error may make the angle less than 2
|
---|
47 | */
|
---|
48 | #define qh_ANGLEconcave 1.5
|
---|
49 |
|
---|
50 | /*-<a href="qh-merge.htm#TOC"
|
---|
51 | >--------------------------------</a><a name="MRG">-</a>
|
---|
52 |
|
---|
53 | MRG... (mergeType)
|
---|
54 | indicates the type of a merge (mergeT->type)
|
---|
55 | */
|
---|
56 | typedef enum { /* in sort order for facet_mergeset */
|
---|
57 | MRGnone= 0,
|
---|
58 | MRGcoplanar, /* centrum coplanar */
|
---|
59 | MRGanglecoplanar, /* angle coplanar */
|
---|
60 | /* could detect half concave ridges */
|
---|
61 | MRGconcave, /* concave ridge */
|
---|
62 | MRGflip, /* flipped facet. facet1 == facet2 */
|
---|
63 | MRGridge, /* duplicate ridge (qh_MERGEridge) */
|
---|
64 | /* degen and redundant go onto degen_mergeset */
|
---|
65 | MRGdegen, /* degenerate facet (!enough neighbors) facet1 == facet2 */
|
---|
66 | MRGredundant, /* redundant facet (vertex subset) */
|
---|
67 | /* merge_degenredundant assumes degen < redundant */
|
---|
68 | MRGmirror, /* mirror facet from qh_triangulate */
|
---|
69 | ENDmrg
|
---|
70 | } mergeType;
|
---|
71 |
|
---|
72 | /*-<a href="qh-merge.htm#TOC"
|
---|
73 | >--------------------------------</a><a name="qh_MERGEapex">-</a>
|
---|
74 |
|
---|
75 | qh_MERGEapex
|
---|
76 | flag for qh_mergefacet() to indicate an apex merge
|
---|
77 | */
|
---|
78 | #define qh_MERGEapex True
|
---|
79 |
|
---|
80 | /*============ -structures- ====================*/
|
---|
81 |
|
---|
82 | /*-<a href="qh-merge.htm#TOC"
|
---|
83 | >--------------------------------</a><a name="mergeT">-</a>
|
---|
84 |
|
---|
85 | mergeT
|
---|
86 | structure used to merge facets
|
---|
87 | */
|
---|
88 |
|
---|
89 | typedef struct mergeT mergeT;
|
---|
90 | struct mergeT { /* initialize in qh_appendmergeset */
|
---|
91 | realT angle; /* angle between normals of facet1 and facet2 */
|
---|
92 | facetT *facet1; /* will merge facet1 into facet2 */
|
---|
93 | facetT *facet2;
|
---|
94 | mergeType type;
|
---|
95 | };
|
---|
96 |
|
---|
97 |
|
---|
98 | /*=========== -macros- =========================*/
|
---|
99 |
|
---|
100 | /*-<a href="qh-merge.htm#TOC"
|
---|
101 | >--------------------------------</a><a name="FOREACHmerge_">-</a>
|
---|
102 |
|
---|
103 | FOREACHmerge_( merges ) {...}
|
---|
104 | assign 'merge' to each merge in merges
|
---|
105 |
|
---|
106 | notes:
|
---|
107 | uses 'mergeT *merge, **mergep;'
|
---|
108 | if qh_mergefacet(),
|
---|
109 | restart since qh.facet_mergeset may change
|
---|
110 | see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
111 | */
|
---|
112 | #define FOREACHmerge_( merges ) FOREACHsetelement_(mergeT, merges, merge)
|
---|
113 |
|
---|
114 | /*============ prototypes in alphabetical order after pre/postmerge =======*/
|
---|
115 |
|
---|
116 | void qh_premerge(vertexT *apex, realT maxcentrum, realT maxangle);
|
---|
117 | void qh_postmerge(const char *reason, realT maxcentrum, realT maxangle,
|
---|
118 | boolT vneighbors);
|
---|
119 | void qh_all_merges(boolT othermerge, boolT vneighbors);
|
---|
120 | void qh_appendmergeset(facetT *facet, facetT *neighbor, mergeType mergetype, realT *angle);
|
---|
121 | setT *qh_basevertices( facetT *samecycle);
|
---|
122 | void qh_checkconnect(void /* qh new_facets */);
|
---|
123 | boolT qh_checkzero(boolT testall);
|
---|
124 | int qh_compareangle(const void *p1, const void *p2);
|
---|
125 | int qh_comparemerge(const void *p1, const void *p2);
|
---|
126 | int qh_comparevisit(const void *p1, const void *p2);
|
---|
127 | void qh_copynonconvex(ridgeT *atridge);
|
---|
128 | void qh_degen_redundant_facet(facetT *facet);
|
---|
129 | void qh_degen_redundant_neighbors(facetT *facet, facetT *delfacet);
|
---|
130 | vertexT *qh_find_newvertex(vertexT *oldvertex, setT *vertices, setT *ridges);
|
---|
131 | void qh_findbest_test(boolT testcentrum, facetT *facet, facetT *neighbor,
|
---|
132 | facetT **bestfacet, realT *distp, realT *mindistp, realT *maxdistp);
|
---|
133 | facetT *qh_findbestneighbor(facetT *facet, realT *distp, realT *mindistp, realT *maxdistp);
|
---|
134 | void qh_flippedmerges(facetT *facetlist, boolT *wasmerge);
|
---|
135 | void qh_forcedmerges( boolT *wasmerge);
|
---|
136 | void qh_getmergeset(facetT *facetlist);
|
---|
137 | void qh_getmergeset_initial(facetT *facetlist);
|
---|
138 | void qh_hashridge(setT *hashtable, int hashsize, ridgeT *ridge, vertexT *oldvertex);
|
---|
139 | ridgeT *qh_hashridge_find(setT *hashtable, int hashsize, ridgeT *ridge,
|
---|
140 | vertexT *vertex, vertexT *oldvertex, int *hashslot);
|
---|
141 | void qh_makeridges(facetT *facet);
|
---|
142 | void qh_mark_dupridges(facetT *facetlist);
|
---|
143 | void qh_maydropneighbor(facetT *facet);
|
---|
144 | int qh_merge_degenredundant(void);
|
---|
145 | void qh_merge_nonconvex( facetT *facet1, facetT *facet2, mergeType mergetype);
|
---|
146 | void qh_mergecycle(facetT *samecycle, facetT *newfacet);
|
---|
147 | void qh_mergecycle_all(facetT *facetlist, boolT *wasmerge);
|
---|
148 | void qh_mergecycle_facets( facetT *samecycle, facetT *newfacet);
|
---|
149 | void qh_mergecycle_neighbors(facetT *samecycle, facetT *newfacet);
|
---|
150 | void qh_mergecycle_ridges(facetT *samecycle, facetT *newfacet);
|
---|
151 | void qh_mergecycle_vneighbors( facetT *samecycle, facetT *newfacet);
|
---|
152 | void qh_mergefacet(facetT *facet1, facetT *facet2, realT *mindist, realT *maxdist, boolT mergeapex);
|
---|
153 | void qh_mergefacet2d(facetT *facet1, facetT *facet2);
|
---|
154 | void qh_mergeneighbors(facetT *facet1, facetT *facet2);
|
---|
155 | void qh_mergeridges(facetT *facet1, facetT *facet2);
|
---|
156 | void qh_mergesimplex(facetT *facet1, facetT *facet2, boolT mergeapex);
|
---|
157 | void qh_mergevertex_del(vertexT *vertex, facetT *facet1, facetT *facet2);
|
---|
158 | void qh_mergevertex_neighbors(facetT *facet1, facetT *facet2);
|
---|
159 | void qh_mergevertices(setT *vertices1, setT **vertices);
|
---|
160 | setT *qh_neighbor_intersections(vertexT *vertex);
|
---|
161 | void qh_newvertices(setT *vertices);
|
---|
162 | boolT qh_reducevertices(void);
|
---|
163 | vertexT *qh_redundant_vertex(vertexT *vertex);
|
---|
164 | boolT qh_remove_extravertices(facetT *facet);
|
---|
165 | vertexT *qh_rename_sharedvertex(vertexT *vertex, facetT *facet);
|
---|
166 | void qh_renameridgevertex(ridgeT *ridge, vertexT *oldvertex, vertexT *newvertex);
|
---|
167 | void qh_renamevertex(vertexT *oldvertex, vertexT *newvertex, setT *ridges,
|
---|
168 | facetT *oldfacet, facetT *neighborA);
|
---|
169 | boolT qh_test_appendmerge(facetT *facet, facetT *neighbor);
|
---|
170 | boolT qh_test_vneighbors(void /* qh newfacet_list */);
|
---|
171 | void qh_tracemerge(facetT *facet1, facetT *facet2);
|
---|
172 | void qh_tracemerging(void);
|
---|
173 | void qh_updatetested( facetT *facet1, facetT *facet2);
|
---|
174 | setT *qh_vertexridges(vertexT *vertex);
|
---|
175 | void qh_vertexridges_facet(vertexT *vertex, facetT *facet, setT **ridges);
|
---|
176 | void qh_willdelete(facetT *facet, facetT *replace);
|
---|
177 |
|
---|
178 | #endif /* qhDEFmerge */
|
---|