1 | <!-- Do not edit with Front Page, it adds too many spaces -->
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Type"
|
---|
5 | content="text/html; charset=iso-8859-1">
|
---|
6 | <title>qset.c -- set data type and operations</title>
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 | <!-- Navigation links -->
|
---|
11 | <p><a name="TOP"><b>Up:</b></a> <a
|
---|
12 | href="http://www.qhull.org">Home page</a> for Qhull<br>
|
---|
13 | <b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
|
---|
14 | <b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
|
---|
15 | • <a href="../../html/qh-quick.htm#options">Options</a>
|
---|
16 | • <a href="../../html/qh-opto.htm#output">Output</a>
|
---|
17 | • <a href="../../html/qh-optf.htm#format">Formats</a>
|
---|
18 | • <a href="../../html/qh-optg.htm#geomview">Geomview</a>
|
---|
19 | • <a href="../../html/qh-optp.htm#print">Print</a>
|
---|
20 | • <a href="../../html/qh-optq.htm#qhull">Qhull</a>
|
---|
21 | • <a href="../../html/qh-optc.htm#prec">Precision</a>
|
---|
22 | • <a href="../../html/qh-optt.htm#trace">Trace</a><br>
|
---|
23 | <b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
|
---|
24 | <b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
|
---|
25 | <b>To:</b> <a href="qh-geom.htm">Geom</a> • <a href="qh-globa.htm">Global</a>
|
---|
26 | • <a href="qh-io.htm">Io</a> • <a href="qh-mem.htm">Mem</a>
|
---|
27 | • <a href="qh-merge.htm">Merge</a> • <a href="qh-poly.htm">Poly</a>
|
---|
28 | • <a href="qh-qhull.htm">Qhull</a> • <a href="qh-set.htm#TOC">Set</a>
|
---|
29 | • <a href="qh-stat.htm">Stat</a> • <a href="qh-user.htm">User</a>
|
---|
30 | </p>
|
---|
31 | <hr>
|
---|
32 |
|
---|
33 | <h2>qset.c -- set data type and operations</h2>
|
---|
34 | <blockquote>
|
---|
35 | <p>Qhull's data structures are constructed from sets. The
|
---|
36 | functions and macros in qset.c construct, iterate, and
|
---|
37 | modify these sets. They are the most frequently called
|
---|
38 | functions in Qhull. For this reason, efficiency is the
|
---|
39 | primary concern. </p>
|
---|
40 | <p>In Qhull, a <i>set</i> is represented by an unordered
|
---|
41 | array of pointers with a maximum size and a NULL
|
---|
42 | terminator (<a href="qset.h#setT">setT</a>).
|
---|
43 | Most sets correspond to mathematical sets
|
---|
44 | (i.e., the pointers are unique). Some sets are sorted to
|
---|
45 | enforce uniqueness. Some sets are ordered. For example,
|
---|
46 | the order of vertices in a ridge determine the ridge's
|
---|
47 | orientation. If you reverse the order of adjacent
|
---|
48 | vertices, the orientation reverses. Some sets are not
|
---|
49 | mathematical sets. They may be indexed as an array and
|
---|
50 | they may include NULL pointers. </p>
|
---|
51 | <p>The most common operation on a set is to iterate its
|
---|
52 | members. This is done with a 'FOREACH...' macro. Each set
|
---|
53 | has a custom macro. For example, 'FOREACHvertex_'
|
---|
54 | iterates over a set of vertices. Each vertex is assigned
|
---|
55 | to the variable 'vertex' from the pointer 'vertexp'. </p>
|
---|
56 | <p>Most sets are constructed by appending elements to the
|
---|
57 | set. The last element of a set is either NULL or the
|
---|
58 | index of the terminating NULL for a partially full set.
|
---|
59 | If a set is full, appending an element copies the set to
|
---|
60 | a larger array. </p>
|
---|
61 |
|
---|
62 | </blockquote>
|
---|
63 | <p><b>Copyright © 1995-2012 C.B. Barber</b></p>
|
---|
64 | <hr>
|
---|
65 | <p><a href="#TOP">»</a> <a href="qh-geom.htm#TOC">Geom</a>
|
---|
66 | <a name="TOC">•</a> <a href="qh-globa.htm#TOC">Global</a> •
|
---|
67 | <a href="qh-io.htm#TOC">Io</a> • <a href="qh-mem.htm#TOC">Mem</a> •
|
---|
68 | <a href="qh-merge.htm#TOC">Merge</a> • <a href="qh-poly.htm#TOC">Poly</a>
|
---|
69 | • <a href="qh-qhull.htm#TOC">Qhull</a> • <b>Set</b>
|
---|
70 | • <a href="qh-stat.htm#TOC">Stat</a> • <a href="qh-user.htm#TOC">User</a>
|
---|
71 | </p>
|
---|
72 | <h3>Index to <a href="qset.c">qset.c</a> and
|
---|
73 | <a href="qset.h">qset.h</a></h3>
|
---|
74 | <ul>
|
---|
75 | <li><a href="#stype">Data types and constants</a> </li>
|
---|
76 | <li><a href="#seach">FOREACH macros</a> </li>
|
---|
77 | <li><a href="#saccess">access and size macros</a> </li>
|
---|
78 | <li><a href="#sint">internal macros</a> </li>
|
---|
79 | <li><a href="#saddr">address macros</a><p> </li>
|
---|
80 |
|
---|
81 | <li><a href="#snew">Allocation and deallocation functions</a> </li>
|
---|
82 | <li><a href="#spred">Access and predicate functions</a>
|
---|
83 | </li>
|
---|
84 | <li><a href="#sadd">Add functions</a> </li>
|
---|
85 | <li><a href="#scheck">Check and print functions</a></li>
|
---|
86 | <li><a href="#scopy">Copy, compact, and zero functions</a></li>
|
---|
87 | <li><a href="#sdel">Delete functions</a> </li>
|
---|
88 | <li><a href="#stemp">Temporary set functions</a> </li>
|
---|
89 | </ul>
|
---|
90 | <h3><a href="qh-set.htm#TOC">»</a><a name="stype">Data types and
|
---|
91 | constants</a></h3>
|
---|
92 | <ul>
|
---|
93 | <li><a href="qset.h#SETelemsize">SETelemsize</a> size
|
---|
94 | of a set element in bytes </li>
|
---|
95 | <li><a href="qset.h#setT">setT</a> a set with a
|
---|
96 | maximum size and a current size</li>
|
---|
97 | <li><a href="libqhull.h#qh-set">qh global sets</a>
|
---|
98 | global sets for temporary sets, etc. </li>
|
---|
99 | </ul>
|
---|
100 | <h3><a href="qh-set.htm#TOC">»</a><a name="seach">FOREACH macros</a></h3>
|
---|
101 | <ul>
|
---|
102 | <li><a href="qset.h#FOREACHelem_">FOREACHelem_</a>
|
---|
103 | assign 'elem' to each element in a set </li>
|
---|
104 | <li><a href="qset.h#FOREACHset_">FOREACHset_</a>
|
---|
105 | assign 'set' to each set in a set of sets </li>
|
---|
106 | <li><a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
|
---|
107 | define a FOREACH iterator </li>
|
---|
108 | <li><a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
|
---|
109 | define an indexed FOREACH iterator </li>
|
---|
110 | <li><a href="qset.h#FOREACHsetelementreverse_">FOREACHsetelementreverse_</a>
|
---|
111 | define a reversed FOREACH iterator </li>
|
---|
112 | <li><a href="qset.h#FOREACHsetelementreverse12_">FOREACHsetelementreverse12_</a>
|
---|
113 | define a FOREACH iterator with e[1] and e[0]
|
---|
114 | reversed </li>
|
---|
115 | </ul>
|
---|
116 | <h3><a href="qh-set.htm#TOC">»</a><a name="saccess">Access and
|
---|
117 | size macros</a></h3>
|
---|
118 | <ul>
|
---|
119 | <li><a href="qset.h#SETelem_">SETelem_</a> return the
|
---|
120 | n'th element of set </li>
|
---|
121 | <li><a href="qset.h#SETelemt_">SETelemt_</a> return
|
---|
122 | the n'th element of set as a type</li>
|
---|
123 | <li><a href="qset.h#SETempty_">SETempty_</a> return
|
---|
124 | true (1) if set is empty </li>
|
---|
125 | <li><a href="qset.h#SETfirst_">SETfirst_</a> return
|
---|
126 | first element of set </li>
|
---|
127 | <li><a href="qset.h#SETfirstt_">SETfirstt_</a> return
|
---|
128 | first element of set as a type</li>
|
---|
129 | <li><a href="qset.h#SETindex_">SETindex_</a> return
|
---|
130 | index of elem in set </li>
|
---|
131 | <li><a href="qset.h#SETreturnsize_">SETreturnsize_</a>
|
---|
132 | return size of a set (normally use <a href="qset.c#setsize">qh_setsize</a>) </li>
|
---|
133 | <li><a href="qset.h#SETsecond_">SETsecond_</a> return
|
---|
134 | second element of set </li>
|
---|
135 | <li><a href="qset.h#SETsecondt_">SETsecondt_</a>
|
---|
136 | return second element of set as a type</li>
|
---|
137 | <li><a href="qset.h#SETtruncate_">SETtruncate_</a>
|
---|
138 | truncate set to size, i.e., qh_settruncate()</li>
|
---|
139 | </ul>
|
---|
140 | <h3><a href="qh-set.htm#TOC">»</a><a name="sint">Internal macros</a></h3>
|
---|
141 | <ul>
|
---|
142 | <li><a href="qset.c#SETsizeaddr_">SETsizeaddr_</a>
|
---|
143 | return pointer to end element of a set (indicates
|
---|
144 | current size) </li>
|
---|
145 | </ul>
|
---|
146 |
|
---|
147 | <h3><a href="qh-set.htm#TOC">»</a><a name="saddr">address macros</a></h3>
|
---|
148 | <ul>
|
---|
149 | <li><a href="qset.h#SETaddr_">SETaddr_</a> return
|
---|
150 | address of a set's elements </li>
|
---|
151 | <li><a href="qset.h#SETelemaddr_">SETelemaddr_</a>
|
---|
152 | return address of the n'th element of a set </li>
|
---|
153 | <li><a href="qset.h#SETref_">SETref_</a> l.h.s. for
|
---|
154 | modifying the current element in a FOREACH
|
---|
155 | iteration </li>
|
---|
156 | </ul>
|
---|
157 |
|
---|
158 | <h3><a href="qh-set.htm#TOC">»</a><a name="snew">Allocation and
|
---|
159 | deallocation functions</a></h3>
|
---|
160 | <ul>
|
---|
161 | <li><a href="qset.c#setfree">qh_setfree</a> free the
|
---|
162 | space occupied by a set </li>
|
---|
163 | <li><a href="qset.c#setfree2">qh_setfree2</a> free a
|
---|
164 | set and its elements </li>
|
---|
165 | <li><a href="qset.c#setfreelong">qh_setfreelong</a>
|
---|
166 | free a set only if it is in long memory </li>
|
---|
167 | <li><a href="qset.c#setnew">qh_setnew</a> create a new
|
---|
168 | set </li>
|
---|
169 | </ul>
|
---|
170 |
|
---|
171 | <h3><a href="qh-set.htm#TOC">»</a><a name="spred">Access and
|
---|
172 | predicate functions </a></h3>
|
---|
173 | <ul>
|
---|
174 | <li><a href="qset.c#setendpointer">qh_setendpointer</a> return
|
---|
175 | pointer to NULL terminator of a set</li>
|
---|
176 | <li><a href="qset.c#setequal">qh_setequal</a> return 1
|
---|
177 | if two sorted sets are equal </li>
|
---|
178 | <li><a href="qset.c#setequal_except">qh_setequal_except</a>
|
---|
179 | return 1 if two sorted sets are equal except for
|
---|
180 | an element </li>
|
---|
181 | <li><a href="qset.c#setequal_skip">qh_setequal_skip</a>
|
---|
182 | return 1 if two sorted sets are equal except for
|
---|
183 | a pair of skipped elements </li>
|
---|
184 | <li><a href="qset.c#setequal_skip">qh_setequal_skip</a>
|
---|
185 | return 1 if two sorted sets are equal except for
|
---|
186 | a pair of skipped elements </li>
|
---|
187 | <li><a href="qset.c#setin">qh_setin</a> return 1 if an
|
---|
188 | element is in a set </li>
|
---|
189 | <li><a href="qset.c#setindex">qh_setindex</a> return
|
---|
190 | the index of an element in a set </li>
|
---|
191 | <li><a href="qset.c#setlast">qh_setlast</a> return
|
---|
192 | last element of a set</li>
|
---|
193 | <li><a href="qset.c#setsize">qh_setsize</a> returns
|
---|
194 | the size of a set </li>
|
---|
195 | </ul>
|
---|
196 |
|
---|
197 | <h3><a href="qh-set.htm#TOC">»</a><a name="sadd">Add functions</a></h3>
|
---|
198 | <ul>
|
---|
199 | <li><a href="qset.c#setaddnth">qh_setaddnth</a> add a
|
---|
200 | element as n'th element of sorted or unsorted set
|
---|
201 | </li>
|
---|
202 | <li><a href="qset.c#setaddsorted">qh_setaddsorted</a>
|
---|
203 | add an element to a sorted set </li>
|
---|
204 | <li><a href="qset.c#setappend">qh_setappend</a> append
|
---|
205 | an element to a set </li>
|
---|
206 | <li><a href="qset.c#setappend_set">qh_setappend_set</a>
|
---|
207 | append a set of elements to a set </li>
|
---|
208 | <li><a href="qset.c#setappend2ndlast">qh_setappend2ndlast</a>
|
---|
209 | add an element as the next to the last element in
|
---|
210 | a set </li>
|
---|
211 | <li><a href="qset.c#setlarger">qh_setlarger</a> return
|
---|
212 | a larger set with the same elements</li>
|
---|
213 | <li><a href="qset.c#setreplace">qh_setreplace</a>
|
---|
214 | replace one element with another in a set</li>
|
---|
215 | <li><a href="qset.c#setunique">qh_setunique</a> add an
|
---|
216 | element if it is not already in a set </li>
|
---|
217 | </ul>
|
---|
218 |
|
---|
219 | <h3><a href="qh-set.htm#TOC">»</a><a name="scheck">Check and print functions</a></h3>
|
---|
220 | <ul>
|
---|
221 | <li><a href="qset.c#setcheck">qh_setcheck</a> check a
|
---|
222 | set for validity </li>
|
---|
223 | <li><a href="qset.c#setprint">qh_setprint</a> print a
|
---|
224 | set's elements to fp </li>
|
---|
225 | </ul>
|
---|
226 |
|
---|
227 | <h3><a href="qh-set.htm#TOC">»</a><a name="scopy">Copy, compact, and zero functions</a></h3>
|
---|
228 | <ul>
|
---|
229 | <li><a href="qset.c#setcompact">qh_setcompact</a>
|
---|
230 | compact NULLs from an unsorted set </li>
|
---|
231 | <li><a href="qset.c#setcopy">qh_setcopy</a> make a
|
---|
232 | copy of a sorted or unsorted set </li>
|
---|
233 | <li><a href="qset.c#setduplicate">qh_setduplicate</a>
|
---|
234 | duplicate a set and its elements </li>
|
---|
235 | <li><a href="qset.c#settruncate">qh_settruncate</a>
|
---|
236 | truncate a set to size elements </li>
|
---|
237 | <li><a href="qset.c#setzero">qh_setzero</a> zero the
|
---|
238 | remainder of a set </li>
|
---|
239 | </ul>
|
---|
240 |
|
---|
241 | <h3><a href="qh-set.htm#TOC">»</a><a name="sdel">Delete functions</a></h3>
|
---|
242 | <ul>
|
---|
243 | <li><a href="qset.c#setdel">qh_setdel</a> delete an
|
---|
244 | element from an unsorted set. </li>
|
---|
245 | <li><a href="qset.c#setdellast">qh_setdellast</a>
|
---|
246 | delete and return last element from a set</li>
|
---|
247 | <li><a href="qset.c#setdelnth">qh_setdelnth</a> delete
|
---|
248 | and return nth element from an unsorted set </li>
|
---|
249 | <li><a href="qset.c#setdelnthsorted">qh_setdelnthsorted</a>
|
---|
250 | delete and return nth element from a sorted set </li>
|
---|
251 | <li><a href="qset.c#setdelsorted">qh_setdelsorted</a>
|
---|
252 | delete an element from a sorted set </li>
|
---|
253 | <li><a href="qset.c#setnew_delnthsorted">qh_setnew_delnthsorted</a>
|
---|
254 | create a sorted set not containing the nth
|
---|
255 | element </li>
|
---|
256 | </ul>
|
---|
257 |
|
---|
258 | <h3><a href="qh-set.htm#TOC">»</a><a name="stemp">Temporary set functions</a></h3>
|
---|
259 | <ul>
|
---|
260 | <li><a href="qset.c#settemp">qh_settemp</a> return a
|
---|
261 | temporary set and append it qhmem.tempstack</li>
|
---|
262 | <li><a href="qset.c#settempfree">qh_settempfree</a>
|
---|
263 | free and pop a set from qhmem.tempstack</li>
|
---|
264 | <li><a href="qset.c#settempfree_all">qh_settempfree_all</a>
|
---|
265 | free all sets in qhmem.tempstack </li>
|
---|
266 | <li><a href="qset.c#settemppop">qh_settemppop</a> pop
|
---|
267 | a set from qhmem.tempstack (makes it permanent) </li>
|
---|
268 | <li><a href="qset.c#settemppush">qh_settemppush</a>
|
---|
269 | push a set unto qhmem.tempstack (makes it
|
---|
270 | temporary) </li>
|
---|
271 | </ul>
|
---|
272 |
|
---|
273 | <p><!-- Navigation links --> </p>
|
---|
274 | <hr>
|
---|
275 | <p><b>Up:</b>
|
---|
276 | <a href="http://www.qhull.org">Home page for
|
---|
277 | Qhull</a> <br>
|
---|
278 | <b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
|
---|
279 | <b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
|
---|
280 | • <a href="../../html/qh-quick.htm#options">Options</a>
|
---|
281 | • <a href="../../html/qh-opto.htm#output">Output</a>
|
---|
282 | • <a href="../../html/qh-optf.htm#format">Formats</a>
|
---|
283 | • <a href="../../html/qh-optg.htm#geomview">Geomview</a>
|
---|
284 | • <a href="../../html/qh-optp.htm#print">Print</a>
|
---|
285 | • <a href="../../html/qh-optq.htm#qhull">Qhull</a>
|
---|
286 | • <a href="../../html/qh-optc.htm#prec">Precision</a>
|
---|
287 | • <a href="../../html/qh-optt.htm#trace">Trace</a><br>
|
---|
288 | <b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
|
---|
289 | <b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
|
---|
290 | <b>To:</b> <a href="qh-geom.htm">Geom</a> •
|
---|
291 | <a href="qh-globa.htm">Global</a> • <a href="qh-io.htm">Io</a>
|
---|
292 | • <a href="qh-mem.htm">Mem</a> • <a href="qh-merge.htm">Merge</a>
|
---|
293 | • <a href="qh-poly.htm">Poly</a> • <a href="qh-qhull.htm#TOC">Qhull</a>
|
---|
294 | • <a href="qh-set.htm">Set</a> • <a href="qh-stat.htm">Stat</a>
|
---|
295 | • <a href="qh-user.htm">User</a><br>
|
---|
296 | </p>
|
---|
297 | <p><!-- GC common information --> </p>
|
---|
298 | <hr>
|
---|
299 | <p><a href="http://www.geom.uiuc.edu/"><img
|
---|
300 | src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
|
---|
301 | Geometry Center Home Page </i></p>
|
---|
302 | <p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
|
---|
303 | </a><br>
|
---|
304 | Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
|
---|
305 | </body>
|
---|
306 | </html>
|
---|