1 | /*<html><pre> -<a href="qh-user.htm"
|
---|
2 | >-------------------------------</a><a name="TOP">-</a>
|
---|
3 |
|
---|
4 | user.h
|
---|
5 | user redefinable constants
|
---|
6 |
|
---|
7 | see qh-user.htm. see COPYING for copyright information.
|
---|
8 |
|
---|
9 | before reading any code, review libqhull.h for data structure definitions and
|
---|
10 | the "qh" macro.
|
---|
11 |
|
---|
12 | Sections:
|
---|
13 | ============= qhull library constants ======================
|
---|
14 | ============= data types and configuration macros ==========
|
---|
15 | ============= performance related constants ================
|
---|
16 | ============= memory constants =============================
|
---|
17 | ============= joggle constants =============================
|
---|
18 | ============= conditional compilation ======================
|
---|
19 | ============= -merge constants- ============================
|
---|
20 |
|
---|
21 | Code flags --
|
---|
22 | NOerrors -- the code does not call qh_errexit()
|
---|
23 | WARN64 -- the code may be incompatible with 64-bit pointers
|
---|
24 |
|
---|
25 | */
|
---|
26 |
|
---|
27 | #include <time.h>
|
---|
28 |
|
---|
29 | #ifndef qhDEFuser
|
---|
30 | #define qhDEFuser 1
|
---|
31 |
|
---|
32 | /*============================================================*/
|
---|
33 | /*============= qhull library constants ======================*/
|
---|
34 | /*============================================================*/
|
---|
35 |
|
---|
36 | /*-<a href="qh-user.htm#TOC"
|
---|
37 | >--------------------------------</a><a name="filenamelen">-</a>
|
---|
38 |
|
---|
39 | FILENAMElen -- max length for TI and TO filenames
|
---|
40 |
|
---|
41 | */
|
---|
42 |
|
---|
43 | #define qh_FILENAMElen 500
|
---|
44 |
|
---|
45 | /*-<a href="qh-user.htm#TOC"
|
---|
46 | >--------------------------------</a><a name="msgcode">-</a>
|
---|
47 |
|
---|
48 | msgcode -- Unique message codes for qh_fprintf
|
---|
49 |
|
---|
50 | If add new messages, assign these values and increment.
|
---|
51 |
|
---|
52 | def counters = [27, 1047, 2059, 3025, 4068, 5003,
|
---|
53 | 6241, 7079, 8143, 9410, 10000, 11026]
|
---|
54 |
|
---|
55 | See: qh_ERR* [libqhull.h]
|
---|
56 | */
|
---|
57 |
|
---|
58 | #define MSG_TRACE0 0
|
---|
59 | #define MSG_TRACE1 1000
|
---|
60 | #define MSG_TRACE2 2000
|
---|
61 | #define MSG_TRACE3 3000
|
---|
62 | #define MSG_TRACE4 4000
|
---|
63 | #define MSG_TRACE5 5000
|
---|
64 | #define MSG_ERROR 6000 /* errors written to qh.ferr */
|
---|
65 | #define MSG_WARNING 7000
|
---|
66 | #define MSG_STDERR 8000 /* log messages Written to qh.ferr */
|
---|
67 | #define MSG_OUTPUT 9000
|
---|
68 | #define MSG_QHULL_ERROR 10000 /* errors thrown by QhullError [QhullError.h] */
|
---|
69 | #define MSG_FIXUP 11000 /* FIXUP QH11... */
|
---|
70 | #define MSG_MAXLEN 3000 /* qh_printhelp_degenerate() in user.c */
|
---|
71 |
|
---|
72 |
|
---|
73 | /*-<a href="qh-user.htm#TOC"
|
---|
74 | >--------------------------------</a><a name="qh_OPTIONline">-</a>
|
---|
75 |
|
---|
76 | qh_OPTIONline -- max length of an option line 'FO'
|
---|
77 | */
|
---|
78 | #define qh_OPTIONline 80
|
---|
79 |
|
---|
80 | /*============================================================*/
|
---|
81 | /*============= data types and configuration macros ==========*/
|
---|
82 | /*============================================================*/
|
---|
83 |
|
---|
84 | /*-<a href="qh-user.htm#TOC"
|
---|
85 | >--------------------------------</a><a name="realT">-</a>
|
---|
86 |
|
---|
87 | realT
|
---|
88 | set the size of floating point numbers
|
---|
89 |
|
---|
90 | qh_REALdigits
|
---|
91 | maximimum number of significant digits
|
---|
92 |
|
---|
93 | qh_REAL_1, qh_REAL_2n, qh_REAL_3n
|
---|
94 | format strings for printf
|
---|
95 |
|
---|
96 | qh_REALmax, qh_REALmin
|
---|
97 | maximum and minimum (near zero) values
|
---|
98 |
|
---|
99 | qh_REALepsilon
|
---|
100 | machine roundoff. Maximum roundoff error for addition and multiplication.
|
---|
101 |
|
---|
102 | notes:
|
---|
103 | Select whether to store floating point numbers in single precision (float)
|
---|
104 | or double precision (double).
|
---|
105 |
|
---|
106 | Use 'float' to save about 8% in time and 25% in space. This is particularly
|
---|
107 | helpful if high-d where convex hulls are space limited. Using 'float' also
|
---|
108 | reduces the printed size of Qhull's output since numbers have 8 digits of
|
---|
109 | precision.
|
---|
110 |
|
---|
111 | Use 'double' when greater arithmetic precision is needed. This is needed
|
---|
112 | for Delaunay triangulations and Voronoi diagrams when you are not merging
|
---|
113 | facets.
|
---|
114 |
|
---|
115 | If 'double' gives insufficient precision, your data probably includes
|
---|
116 | degeneracies. If so you should use facet merging (done by default)
|
---|
117 | or exact arithmetic (see imprecision section of manual, qh-impre.htm).
|
---|
118 | You may also use option 'Po' to force output despite precision errors.
|
---|
119 |
|
---|
120 | You may use 'long double', but many format statements need to be changed
|
---|
121 | and you may need a 'long double' square root routine. S. Grundmann
|
---|
122 | (sg@eeiwzb.et.tu-dresden.de) has done this. He reports that the code runs
|
---|
123 | much slower with little gain in precision.
|
---|
124 |
|
---|
125 | WARNING: on some machines, int f(){realT a= REALmax;return (a == REALmax);}
|
---|
126 | returns False. Use (a > REALmax/2) instead of (a == REALmax).
|
---|
127 |
|
---|
128 | REALfloat = 1 all numbers are 'float' type
|
---|
129 | = 0 all numbers are 'double' type
|
---|
130 | */
|
---|
131 | #define REALfloat 0
|
---|
132 |
|
---|
133 | #if (REALfloat == 1)
|
---|
134 | #define realT float
|
---|
135 | #define REALmax FLT_MAX
|
---|
136 | #define REALmin FLT_MIN
|
---|
137 | #define REALepsilon FLT_EPSILON
|
---|
138 | #define qh_REALdigits 8 /* maximum number of significant digits */
|
---|
139 | #define qh_REAL_1 "%6.8g "
|
---|
140 | #define qh_REAL_2n "%6.8g %6.8g\n"
|
---|
141 | #define qh_REAL_3n "%6.8g %6.8g %6.8g\n"
|
---|
142 |
|
---|
143 | #elif (REALfloat == 0)
|
---|
144 | #define realT double
|
---|
145 | #define REALmax DBL_MAX
|
---|
146 | #define REALmin DBL_MIN
|
---|
147 | #define REALepsilon DBL_EPSILON
|
---|
148 | #define qh_REALdigits 16 /* maximum number of significant digits */
|
---|
149 | #define qh_REAL_1 "%6.16g "
|
---|
150 | #define qh_REAL_2n "%6.16g %6.16g\n"
|
---|
151 | #define qh_REAL_3n "%6.16g %6.16g %6.16g\n"
|
---|
152 |
|
---|
153 | #else
|
---|
154 | #error unknown float option
|
---|
155 | #endif
|
---|
156 |
|
---|
157 | /*-<a href="qh-user.htm#TOC"
|
---|
158 | >--------------------------------</a><a name="CPUclock">-</a>
|
---|
159 |
|
---|
160 | qh_CPUclock
|
---|
161 | define the clock() function for reporting the total time spent by Qhull
|
---|
162 | returns CPU ticks as a 'long int'
|
---|
163 | qh_CPUclock is only used for reporting the total time spent by Qhull
|
---|
164 |
|
---|
165 | qh_SECticks
|
---|
166 | the number of clock ticks per second
|
---|
167 |
|
---|
168 | notes:
|
---|
169 | looks for CLOCKS_PER_SEC, CLOCKS_PER_SECOND, or assumes microseconds
|
---|
170 | to define a custom clock, set qh_CLOCKtype to 0
|
---|
171 |
|
---|
172 | if your system does not use clock() to return CPU ticks, replace
|
---|
173 | qh_CPUclock with the corresponding function. It is converted
|
---|
174 | to 'unsigned long' to prevent wrap-around during long runs. By default,
|
---|
175 | <time.h> defines clock_t as 'long'
|
---|
176 |
|
---|
177 | Set qh_CLOCKtype to
|
---|
178 |
|
---|
179 | 1 for CLOCKS_PER_SEC, CLOCKS_PER_SECOND, or microsecond
|
---|
180 | Note: may fail if more than 1 hour elapsed time
|
---|
181 |
|
---|
182 | 2 use qh_clock() with POSIX times() (see global.c)
|
---|
183 | */
|
---|
184 | #define qh_CLOCKtype 1 /* change to the desired number */
|
---|
185 |
|
---|
186 | #if (qh_CLOCKtype == 1)
|
---|
187 |
|
---|
188 | #if defined(CLOCKS_PER_SECOND)
|
---|
189 | #define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
|
---|
190 | #define qh_SECticks CLOCKS_PER_SECOND
|
---|
191 |
|
---|
192 | #elif defined(CLOCKS_PER_SEC)
|
---|
193 | #define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
|
---|
194 | #define qh_SECticks CLOCKS_PER_SEC
|
---|
195 |
|
---|
196 | #elif defined(CLK_TCK)
|
---|
197 | #define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
|
---|
198 | #define qh_SECticks CLK_TCK
|
---|
199 |
|
---|
200 | #else
|
---|
201 | #define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
|
---|
202 | #define qh_SECticks 1E6
|
---|
203 | #endif
|
---|
204 |
|
---|
205 | #elif (qh_CLOCKtype == 2)
|
---|
206 | #define qh_CPUclock qh_clock() /* return CPU clock */
|
---|
207 | #define qh_SECticks 100
|
---|
208 |
|
---|
209 | #else /* qh_CLOCKtype == ? */
|
---|
210 | #error unknown clock option
|
---|
211 | #endif
|
---|
212 |
|
---|
213 | /*-<a href="qh-user.htm#TOC"
|
---|
214 | >--------------------------------</a><a name="RANDOM">-</a>
|
---|
215 |
|
---|
216 | qh_RANDOMtype, qh_RANDOMmax, qh_RANDOMseed
|
---|
217 | define random number generator
|
---|
218 |
|
---|
219 | qh_RANDOMint generates a random integer between 0 and qh_RANDOMmax.
|
---|
220 | qh_RANDOMseed sets the random number seed for qh_RANDOMint
|
---|
221 |
|
---|
222 | Set qh_RANDOMtype (default 5) to:
|
---|
223 | 1 for random() with 31 bits (UCB)
|
---|
224 | 2 for rand() with RAND_MAX or 15 bits (system 5)
|
---|
225 | 3 for rand() with 31 bits (Sun)
|
---|
226 | 4 for lrand48() with 31 bits (Solaris)
|
---|
227 | 5 for qh_rand() with 31 bits (included with Qhull)
|
---|
228 |
|
---|
229 | notes:
|
---|
230 | Random numbers are used by rbox to generate point sets. Random
|
---|
231 | numbers are used by Qhull to rotate the input ('QRn' option),
|
---|
232 | simulate a randomized algorithm ('Qr' option), and to simulate
|
---|
233 | roundoff errors ('Rn' option).
|
---|
234 |
|
---|
235 | Random number generators differ between systems. Most systems provide
|
---|
236 | rand() but the period varies. The period of rand() is not critical
|
---|
237 | since qhull does not normally use random numbers.
|
---|
238 |
|
---|
239 | The default generator is Park & Miller's minimal standard random
|
---|
240 | number generator [CACM 31:1195 '88]. It is included with Qhull.
|
---|
241 |
|
---|
242 | If qh_RANDOMmax is wrong, qhull will report a warning and Geomview
|
---|
243 | output will likely be invisible.
|
---|
244 | */
|
---|
245 | #define qh_RANDOMtype 5 /* *** change to the desired number *** */
|
---|
246 |
|
---|
247 | #if (qh_RANDOMtype == 1)
|
---|
248 | #define qh_RANDOMmax ((realT)0x7fffffffUL) /* 31 bits, random()/MAX */
|
---|
249 | #define qh_RANDOMint random()
|
---|
250 | #define qh_RANDOMseed_(seed) srandom(seed);
|
---|
251 |
|
---|
252 | #elif (qh_RANDOMtype == 2)
|
---|
253 | #ifdef RAND_MAX
|
---|
254 | #define qh_RANDOMmax ((realT)RAND_MAX)
|
---|
255 | #else
|
---|
256 | #define qh_RANDOMmax ((realT)32767) /* 15 bits (System 5) */
|
---|
257 | #endif
|
---|
258 | #define qh_RANDOMint rand()
|
---|
259 | #define qh_RANDOMseed_(seed) srand((unsigned)seed);
|
---|
260 |
|
---|
261 | #elif (qh_RANDOMtype == 3)
|
---|
262 | #define qh_RANDOMmax ((realT)0x7fffffffUL) /* 31 bits, Sun */
|
---|
263 | #define qh_RANDOMint rand()
|
---|
264 | #define qh_RANDOMseed_(seed) srand((unsigned)seed);
|
---|
265 |
|
---|
266 | #elif (qh_RANDOMtype == 4)
|
---|
267 | #define qh_RANDOMmax ((realT)0x7fffffffUL) /* 31 bits, lrand38()/MAX */
|
---|
268 | #define qh_RANDOMint lrand48()
|
---|
269 | #define qh_RANDOMseed_(seed) srand48(seed);
|
---|
270 |
|
---|
271 | #elif (qh_RANDOMtype == 5)
|
---|
272 | #define qh_RANDOMmax ((realT)2147483646UL) /* 31 bits, qh_rand/MAX */
|
---|
273 | #define qh_RANDOMint qh_rand()
|
---|
274 | #define qh_RANDOMseed_(seed) qh_srand(seed);
|
---|
275 | /* unlike rand(), never returns 0 */
|
---|
276 |
|
---|
277 | #else
|
---|
278 | #error: unknown random option
|
---|
279 | #endif
|
---|
280 |
|
---|
281 | /*-<a href="qh-user.htm#TOC"
|
---|
282 | >--------------------------------</a><a name="ORIENTclock">-</a>
|
---|
283 |
|
---|
284 | qh_ORIENTclock
|
---|
285 | 0 for inward pointing normals by Geomview convention
|
---|
286 | */
|
---|
287 | #define qh_ORIENTclock 0
|
---|
288 |
|
---|
289 |
|
---|
290 | /*============================================================*/
|
---|
291 | /*============= joggle constants =============================*/
|
---|
292 | /*============================================================*/
|
---|
293 |
|
---|
294 | /*-<a href="qh-user.htm#TOC"
|
---|
295 | >--------------------------------</a><a name="JOGGLEdefault">-</a>
|
---|
296 |
|
---|
297 | qh_JOGGLEdefault
|
---|
298 | default qh.JOGGLEmax is qh.DISTround * qh_JOGGLEdefault
|
---|
299 |
|
---|
300 | notes:
|
---|
301 | rbox s r 100 | qhull QJ1e-15 QR0 generates 90% faults at distround 7e-16
|
---|
302 | rbox s r 100 | qhull QJ1e-14 QR0 generates 70% faults
|
---|
303 | rbox s r 100 | qhull QJ1e-13 QR0 generates 35% faults
|
---|
304 | rbox s r 100 | qhull QJ1e-12 QR0 generates 8% faults
|
---|
305 | rbox s r 100 | qhull QJ1e-11 QR0 generates 1% faults
|
---|
306 | rbox s r 100 | qhull QJ1e-10 QR0 generates 0% faults
|
---|
307 | rbox 1000 W0 | qhull QJ1e-12 QR0 generates 86% faults
|
---|
308 | rbox 1000 W0 | qhull QJ1e-11 QR0 generates 20% faults
|
---|
309 | rbox 1000 W0 | qhull QJ1e-10 QR0 generates 2% faults
|
---|
310 | the later have about 20 points per facet, each of which may interfere
|
---|
311 |
|
---|
312 | pick a value large enough to avoid retries on most inputs
|
---|
313 | */
|
---|
314 | #define qh_JOGGLEdefault 30000.0
|
---|
315 |
|
---|
316 | /*-<a href="qh-user.htm#TOC"
|
---|
317 | >--------------------------------</a><a name="JOGGLEincrease">-</a>
|
---|
318 |
|
---|
319 | qh_JOGGLEincrease
|
---|
320 | factor to increase qh.JOGGLEmax on qh_JOGGLEretry or qh_JOGGLEagain
|
---|
321 | */
|
---|
322 | #define qh_JOGGLEincrease 10.0
|
---|
323 |
|
---|
324 | /*-<a href="qh-user.htm#TOC"
|
---|
325 | >--------------------------------</a><a name="JOGGLEretry">-</a>
|
---|
326 |
|
---|
327 | qh_JOGGLEretry
|
---|
328 | if ZZretry = qh_JOGGLEretry, increase qh.JOGGLEmax
|
---|
329 |
|
---|
330 | notes:
|
---|
331 | try twice at the original value in case of bad luck the first time
|
---|
332 | */
|
---|
333 | #define qh_JOGGLEretry 2
|
---|
334 |
|
---|
335 | /*-<a href="qh-user.htm#TOC"
|
---|
336 | >--------------------------------</a><a name="JOGGLEagain">-</a>
|
---|
337 |
|
---|
338 | qh_JOGGLEagain
|
---|
339 | every following qh_JOGGLEagain, increase qh.JOGGLEmax
|
---|
340 |
|
---|
341 | notes:
|
---|
342 | 1 is OK since it's already failed qh_JOGGLEretry times
|
---|
343 | */
|
---|
344 | #define qh_JOGGLEagain 1
|
---|
345 |
|
---|
346 | /*-<a href="qh-user.htm#TOC"
|
---|
347 | >--------------------------------</a><a name="JOGGLEmaxincrease">-</a>
|
---|
348 |
|
---|
349 | qh_JOGGLEmaxincrease
|
---|
350 | maximum qh.JOGGLEmax due to qh_JOGGLEincrease
|
---|
351 | relative to qh.MAXwidth
|
---|
352 |
|
---|
353 | notes:
|
---|
354 | qh.joggleinput will retry at this value until qh_JOGGLEmaxretry
|
---|
355 | */
|
---|
356 | #define qh_JOGGLEmaxincrease 1e-2
|
---|
357 |
|
---|
358 | /*-<a href="qh-user.htm#TOC"
|
---|
359 | >--------------------------------</a><a name="JOGGLEmaxretry">-</a>
|
---|
360 |
|
---|
361 | qh_JOGGLEmaxretry
|
---|
362 | stop after qh_JOGGLEmaxretry attempts
|
---|
363 | */
|
---|
364 | #define qh_JOGGLEmaxretry 100
|
---|
365 |
|
---|
366 | /*============================================================*/
|
---|
367 | /*============= performance related constants ================*/
|
---|
368 | /*============================================================*/
|
---|
369 |
|
---|
370 | /*-<a href="qh-user.htm#TOC"
|
---|
371 | >--------------------------------</a><a name="HASHfactor">-</a>
|
---|
372 |
|
---|
373 | qh_HASHfactor
|
---|
374 | total hash slots / used hash slots. Must be at least 1.1.
|
---|
375 |
|
---|
376 | notes:
|
---|
377 | =2 for at worst 50% occupancy for qh hash_table and normally 25% occupancy
|
---|
378 | */
|
---|
379 | #define qh_HASHfactor 2
|
---|
380 |
|
---|
381 | /*-<a href="qh-user.htm#TOC"
|
---|
382 | >--------------------------------</a><a name="VERIFYdirect">-</a>
|
---|
383 |
|
---|
384 | qh_VERIFYdirect
|
---|
385 | with 'Tv' verify all points against all facets if op count is smaller
|
---|
386 |
|
---|
387 | notes:
|
---|
388 | if greater, calls qh_check_bestdist() instead
|
---|
389 | */
|
---|
390 | #define qh_VERIFYdirect 1000000
|
---|
391 |
|
---|
392 | /*-<a href="qh-user.htm#TOC"
|
---|
393 | >--------------------------------</a><a name="INITIALsearch">-</a>
|
---|
394 |
|
---|
395 | qh_INITIALsearch
|
---|
396 | if qh_INITIALmax, search points up to this dimension
|
---|
397 | */
|
---|
398 | #define qh_INITIALsearch 6
|
---|
399 |
|
---|
400 | /*-<a href="qh-user.htm#TOC"
|
---|
401 | >--------------------------------</a><a name="INITIALmax">-</a>
|
---|
402 |
|
---|
403 | qh_INITIALmax
|
---|
404 | if dim >= qh_INITIALmax, use min/max coordinate points for initial simplex
|
---|
405 |
|
---|
406 | notes:
|
---|
407 | from points with non-zero determinants
|
---|
408 | use option 'Qs' to override (much slower)
|
---|
409 | */
|
---|
410 | #define qh_INITIALmax 8
|
---|
411 |
|
---|
412 | /*============================================================*/
|
---|
413 | /*============= memory constants =============================*/
|
---|
414 | /*============================================================*/
|
---|
415 |
|
---|
416 | /*-<a href="qh-user.htm#TOC"
|
---|
417 | >--------------------------------</a><a name="MEMalign">-</a>
|
---|
418 |
|
---|
419 | qh_MEMalign
|
---|
420 | memory alignment for qh_meminitbuffers() in global.c
|
---|
421 |
|
---|
422 | notes:
|
---|
423 | to avoid bus errors, memory allocation must consider alignment requirements.
|
---|
424 | malloc() automatically takes care of alignment. Since mem.c manages
|
---|
425 | its own memory, we need to explicitly specify alignment in
|
---|
426 | qh_meminitbuffers().
|
---|
427 |
|
---|
428 | A safe choice is sizeof(double). sizeof(float) may be used if doubles
|
---|
429 | do not occur in data structures and pointers are the same size. Be careful
|
---|
430 | of machines (e.g., DEC Alpha) with large pointers.
|
---|
431 |
|
---|
432 | If using gcc, best alignment is
|
---|
433 | #define qh_MEMalign fmax_(__alignof__(realT),__alignof__(void *))
|
---|
434 | */
|
---|
435 | #define qh_MEMalign ((int)(fmax_(sizeof(realT), sizeof(void *))))
|
---|
436 |
|
---|
437 | /*-<a href="qh-user.htm#TOC"
|
---|
438 | >--------------------------------</a><a name="MEMbufsize">-</a>
|
---|
439 |
|
---|
440 | qh_MEMbufsize
|
---|
441 | size of additional memory buffers
|
---|
442 |
|
---|
443 | notes:
|
---|
444 | used for qh_meminitbuffers() in global.c
|
---|
445 | */
|
---|
446 | #define qh_MEMbufsize 0x10000 /* allocate 64K memory buffers */
|
---|
447 |
|
---|
448 | /*-<a href="qh-user.htm#TOC"
|
---|
449 | >--------------------------------</a><a name="MEMinitbuf">-</a>
|
---|
450 |
|
---|
451 | qh_MEMinitbuf
|
---|
452 | size of initial memory buffer
|
---|
453 |
|
---|
454 | notes:
|
---|
455 | use for qh_meminitbuffers() in global.c
|
---|
456 | */
|
---|
457 | #define qh_MEMinitbuf 0x20000 /* initially allocate 128K buffer */
|
---|
458 |
|
---|
459 | /*-<a href="qh-user.htm#TOC"
|
---|
460 | >--------------------------------</a><a name="INFINITE">-</a>
|
---|
461 |
|
---|
462 | qh_INFINITE
|
---|
463 | on output, indicates Voronoi center at infinity
|
---|
464 | */
|
---|
465 | #define qh_INFINITE -10.101
|
---|
466 |
|
---|
467 | /*-<a href="qh-user.htm#TOC"
|
---|
468 | >--------------------------------</a><a name="DEFAULTbox">-</a>
|
---|
469 |
|
---|
470 | qh_DEFAULTbox
|
---|
471 | default box size (Geomview expects 0.5)
|
---|
472 |
|
---|
473 | qh_DEFAULTbox
|
---|
474 | default box size for integer coorindate (rbox only)
|
---|
475 | */
|
---|
476 | #define qh_DEFAULTbox 0.5
|
---|
477 | #define qh_DEFAULTzbox 1e6
|
---|
478 |
|
---|
479 | /*============================================================*/
|
---|
480 | /*============= conditional compilation ======================*/
|
---|
481 | /*============================================================*/
|
---|
482 |
|
---|
483 | /*-<a href="qh-user.htm#TOC"
|
---|
484 | >--------------------------------</a><a name="compiler">-</a>
|
---|
485 |
|
---|
486 | __cplusplus
|
---|
487 | defined by C++ compilers
|
---|
488 |
|
---|
489 | __MSC_VER
|
---|
490 | defined by Microsoft Visual C++
|
---|
491 |
|
---|
492 | __MWERKS__ && __POWERPC__
|
---|
493 | defined by Metrowerks when compiling for the Power Macintosh
|
---|
494 |
|
---|
495 | __STDC__
|
---|
496 | defined for strict ANSI C
|
---|
497 | */
|
---|
498 |
|
---|
499 | /*-<a href="qh-user.htm#TOC"
|
---|
500 | >--------------------------------</a><a name="COMPUTEfurthest">-</a>
|
---|
501 |
|
---|
502 | qh_COMPUTEfurthest
|
---|
503 | compute furthest distance to an outside point instead of storing it with the facet
|
---|
504 | =1 to compute furthest
|
---|
505 |
|
---|
506 | notes:
|
---|
507 | computing furthest saves memory but costs time
|
---|
508 | about 40% more distance tests for partitioning
|
---|
509 | removes facet->furthestdist
|
---|
510 | */
|
---|
511 | #define qh_COMPUTEfurthest 0
|
---|
512 |
|
---|
513 | /*-<a href="qh-user.htm#TOC"
|
---|
514 | >--------------------------------</a><a name="KEEPstatistics">-</a>
|
---|
515 |
|
---|
516 | qh_KEEPstatistics
|
---|
517 | =0 removes most of statistic gathering and reporting
|
---|
518 |
|
---|
519 | notes:
|
---|
520 | if 0, code size is reduced by about 4%.
|
---|
521 | */
|
---|
522 | #define qh_KEEPstatistics 1
|
---|
523 |
|
---|
524 | /*-<a href="qh-user.htm#TOC"
|
---|
525 | >--------------------------------</a><a name="MAXoutside">-</a>
|
---|
526 |
|
---|
527 | qh_MAXoutside
|
---|
528 | record outer plane for each facet
|
---|
529 | =1 to record facet->maxoutside
|
---|
530 |
|
---|
531 | notes:
|
---|
532 | this takes a realT per facet and slightly slows down qhull
|
---|
533 | it produces better outer planes for geomview output
|
---|
534 | */
|
---|
535 | #define qh_MAXoutside 1
|
---|
536 |
|
---|
537 | /*-<a href="qh-user.htm#TOC"
|
---|
538 | >--------------------------------</a><a name="NOmerge">-</a>
|
---|
539 |
|
---|
540 | qh_NOmerge
|
---|
541 | disables facet merging if defined
|
---|
542 |
|
---|
543 | notes:
|
---|
544 | This saves about 10% space.
|
---|
545 |
|
---|
546 | Unless 'Q0'
|
---|
547 | qh_NOmerge sets 'QJ' to avoid precision errors
|
---|
548 |
|
---|
549 | #define qh_NOmerge
|
---|
550 |
|
---|
551 | see:
|
---|
552 | <a href="mem.h#NOmem">qh_NOmem</a> in mem.c
|
---|
553 |
|
---|
554 | see user.c/user_eg.c for removing io.o
|
---|
555 | */
|
---|
556 |
|
---|
557 | /*-<a href="qh-user.htm#TOC"
|
---|
558 | >--------------------------------</a><a name="NOtrace">-</a>
|
---|
559 |
|
---|
560 | qh_NOtrace
|
---|
561 | no tracing if defined
|
---|
562 |
|
---|
563 | notes:
|
---|
564 | This saves about 5% space.
|
---|
565 |
|
---|
566 | #define qh_NOtrace
|
---|
567 | */
|
---|
568 |
|
---|
569 | /*-<a href="qh-user.htm#TOC"
|
---|
570 | >--------------------------------</a><a name="QHpointer">-</a>
|
---|
571 |
|
---|
572 | qh_QHpointer
|
---|
573 | access global data with pointer or static structure
|
---|
574 |
|
---|
575 | qh_QHpointer = 1 access globals via a pointer to allocated memory
|
---|
576 | enables qh_saveqhull() and qh_restoreqhull()
|
---|
577 | [2010, gcc] costs about 4% in time and 4% in space
|
---|
578 | [2003, msvc] costs about 8% in time and 2% in space
|
---|
579 |
|
---|
580 | = 0 qh_qh and qh_qhstat are static data structures
|
---|
581 | only one instance of qhull() can be active at a time
|
---|
582 | default value
|
---|
583 |
|
---|
584 | qh_QHpointer_dllimport and qh_dllimport define qh_qh as __declspec(dllimport) [libqhull.h]
|
---|
585 | It is required for msvc-2005. It is not needed for gcc.
|
---|
586 |
|
---|
587 | notes:
|
---|
588 | all global variables for qhull are in qh, qhmem, and qhstat
|
---|
589 | qh is defined in libqhull.h
|
---|
590 | qhmem is defined in mem.h
|
---|
591 | qhstat is defined in stat.h
|
---|
592 | C++ build defines qh_QHpointer [libqhullp.pro, libqhullcpp.pro]
|
---|
593 |
|
---|
594 | see:
|
---|
595 | user_eg.c for an example
|
---|
596 | */
|
---|
597 | #ifdef qh_QHpointer
|
---|
598 | #if qh_dllimport
|
---|
599 | #error QH6207 Qhull error: Use qh_QHpointer_dllimport instead of qh_dllimport with qh_QHpointer
|
---|
600 | #endif
|
---|
601 | #else
|
---|
602 | #define qh_QHpointer 0
|
---|
603 | #if qh_QHpointer_dllimport
|
---|
604 | #error QH6234 Qhull error: Use qh_dllimport instead of qh_QHpointer_dllimport when qh_QHpointer is not defined
|
---|
605 | #endif
|
---|
606 | #endif
|
---|
607 | #if 0 /* sample code */
|
---|
608 | qhT *oldqhA, *oldqhB;
|
---|
609 |
|
---|
610 | exitcode= qh_new_qhull(dim, numpoints, points, ismalloc,
|
---|
611 | flags, outfile, errfile);
|
---|
612 | /* use results from first call to qh_new_qhull */
|
---|
613 | oldqhA= qh_save_qhull();
|
---|
614 | exitcode= qh_new_qhull(dimB, numpointsB, pointsB, ismalloc,
|
---|
615 | flags, outfile, errfile);
|
---|
616 | /* use results from second call to qh_new_qhull */
|
---|
617 | oldqhB= qh_save_qhull();
|
---|
618 | qh_restore_qhull(&oldqhA);
|
---|
619 | /* use results from first call to qh_new_qhull */
|
---|
620 | qh_freeqhull(qh_ALL); /* frees all memory used by first call */
|
---|
621 | qh_restore_qhull(&oldqhB);
|
---|
622 | /* use results from second call to qh_new_qhull */
|
---|
623 | qh_freeqhull(!qh_ALL); /* frees long memory used by second call */
|
---|
624 | qh_memfreeshort(&curlong, &totlong); /* frees short memory and memory allocator */
|
---|
625 | #endif
|
---|
626 |
|
---|
627 | /*-<a href="qh-user.htm#TOC"
|
---|
628 | >--------------------------------</a><a name="QUICKhelp">-</a>
|
---|
629 |
|
---|
630 | qh_QUICKhelp
|
---|
631 | =1 to use abbreviated help messages, e.g., for degenerate inputs
|
---|
632 | */
|
---|
633 | #define qh_QUICKhelp 0
|
---|
634 |
|
---|
635 | /*============================================================*/
|
---|
636 | /*============= -merge constants- ============================*/
|
---|
637 | /*============================================================*/
|
---|
638 | /*
|
---|
639 | These constants effect facet merging. You probably will not need
|
---|
640 | to modify them. They effect the performance of facet merging.
|
---|
641 | */
|
---|
642 |
|
---|
643 | /*-<a href="qh-user.htm#TOC"
|
---|
644 | >--------------------------------</a><a name="DIMmergeVertex">-</a>
|
---|
645 |
|
---|
646 | qh_DIMmergeVertex
|
---|
647 | max dimension for vertex merging (it is not effective in high-d)
|
---|
648 | */
|
---|
649 | #define qh_DIMmergeVertex 6
|
---|
650 |
|
---|
651 | /*-<a href="qh-user.htm#TOC"
|
---|
652 | >--------------------------------</a><a name="DIMreduceBuild">-</a>
|
---|
653 |
|
---|
654 | qh_DIMreduceBuild
|
---|
655 | max dimension for vertex reduction during build (slow in high-d)
|
---|
656 | */
|
---|
657 | #define qh_DIMreduceBuild 5
|
---|
658 |
|
---|
659 | /*-<a href="qh-user.htm#TOC"
|
---|
660 | >--------------------------------</a><a name="BESTcentrum">-</a>
|
---|
661 |
|
---|
662 | qh_BESTcentrum
|
---|
663 | if > 2*dim+n vertices, qh_findbestneighbor() tests centrums (faster)
|
---|
664 | else, qh_findbestneighbor() tests all vertices (much better merges)
|
---|
665 |
|
---|
666 | qh_BESTcentrum2
|
---|
667 | if qh_BESTcentrum2 * DIM3 + BESTcentrum < #vertices tests centrums
|
---|
668 | */
|
---|
669 | #define qh_BESTcentrum 20
|
---|
670 | #define qh_BESTcentrum2 2
|
---|
671 |
|
---|
672 | /*-<a href="qh-user.htm#TOC"
|
---|
673 | >--------------------------------</a><a name="BESTnonconvex">-</a>
|
---|
674 |
|
---|
675 | qh_BESTnonconvex
|
---|
676 | if > dim+n neighbors, qh_findbestneighbor() tests nonconvex ridges.
|
---|
677 |
|
---|
678 | notes:
|
---|
679 | It is needed because qh_findbestneighbor is slow for large facets
|
---|
680 | */
|
---|
681 | #define qh_BESTnonconvex 15
|
---|
682 |
|
---|
683 | /*-<a href="qh-user.htm#TOC"
|
---|
684 | >--------------------------------</a><a name="MAXnewmerges">-</a>
|
---|
685 |
|
---|
686 | qh_MAXnewmerges
|
---|
687 | if >n newmerges, qh_merge_nonconvex() calls qh_reducevertices_centrums.
|
---|
688 |
|
---|
689 | notes:
|
---|
690 | It is needed because postmerge can merge many facets at once
|
---|
691 | */
|
---|
692 | #define qh_MAXnewmerges 2
|
---|
693 |
|
---|
694 | /*-<a href="qh-user.htm#TOC"
|
---|
695 | >--------------------------------</a><a name="MAXnewcentrum">-</a>
|
---|
696 |
|
---|
697 | qh_MAXnewcentrum
|
---|
698 | if <= dim+n vertices (n approximates the number of merges),
|
---|
699 | reset the centrum in qh_updatetested() and qh_mergecycle_facets()
|
---|
700 |
|
---|
701 | notes:
|
---|
702 | needed to reduce cost and because centrums may move too much if
|
---|
703 | many vertices in high-d
|
---|
704 | */
|
---|
705 | #define qh_MAXnewcentrum 5
|
---|
706 |
|
---|
707 | /*-<a href="qh-user.htm#TOC"
|
---|
708 | >--------------------------------</a><a name="COPLANARratio">-</a>
|
---|
709 |
|
---|
710 | qh_COPLANARratio
|
---|
711 | for 3-d+ merging, qh.MINvisible is n*premerge_centrum
|
---|
712 |
|
---|
713 | notes:
|
---|
714 | for non-merging, it's DISTround
|
---|
715 | */
|
---|
716 | #define qh_COPLANARratio 3
|
---|
717 |
|
---|
718 | /*-<a href="qh-user.htm#TOC"
|
---|
719 | >--------------------------------</a><a name="DISToutside">-</a>
|
---|
720 |
|
---|
721 | qh_DISToutside
|
---|
722 | When is a point clearly outside of a facet?
|
---|
723 | Stops search in qh_findbestnew or qh_partitionall
|
---|
724 | qh_findbest uses qh.MINoutside since since it is only called if no merges.
|
---|
725 |
|
---|
726 | notes:
|
---|
727 | 'Qf' always searches for best facet
|
---|
728 | if !qh.MERGING, same as qh.MINoutside.
|
---|
729 | if qh_USEfindbestnew, increase value since neighboring facets may be ill-behaved
|
---|
730 | [Note: Zdelvertextot occurs normally with interior points]
|
---|
731 | RBOX 1000 s Z1 G1e-13 t1001188774 | QHULL Tv
|
---|
732 | When there is a sharp edge, need to move points to a
|
---|
733 | clearly good facet; otherwise may be lost in another partitioning.
|
---|
734 | if too big then O(n^2) behavior for partitioning in cone
|
---|
735 | if very small then important points not processed
|
---|
736 | Needed in qh_partitionall for
|
---|
737 | RBOX 1000 s Z1 G1e-13 t1001032651 | QHULL Tv
|
---|
738 | Needed in qh_findbestnew for many instances of
|
---|
739 | RBOX 1000 s Z1 G1e-13 t | QHULL Tv
|
---|
740 |
|
---|
741 | See:
|
---|
742 | qh_DISToutside -- when is a point clearly outside of a facet
|
---|
743 | qh_SEARCHdist -- when is facet coplanar with the best facet?
|
---|
744 | qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
|
---|
745 | */
|
---|
746 | #define qh_DISToutside ((qh_USEfindbestnew ? 2 : 1) * \
|
---|
747 | fmax_((qh MERGING ? 2 : 1)*qh MINoutside, qh max_outside))
|
---|
748 |
|
---|
749 | /*-<a href="qh-user.htm#TOC"
|
---|
750 | >--------------------------------</a><a name="RATIOnearinside">-</a>
|
---|
751 |
|
---|
752 | qh_RATIOnearinside
|
---|
753 | ratio of qh.NEARinside to qh.ONEmerge for retaining inside points for
|
---|
754 | qh_check_maxout().
|
---|
755 |
|
---|
756 | notes:
|
---|
757 | This is overkill since do not know the correct value.
|
---|
758 | It effects whether 'Qc' reports all coplanar points
|
---|
759 | Not used for 'd' since non-extreme points are coplanar
|
---|
760 | */
|
---|
761 | #define qh_RATIOnearinside 5
|
---|
762 |
|
---|
763 | /*-<a href="qh-user.htm#TOC"
|
---|
764 | >--------------------------------</a><a name="SEARCHdist">-</a>
|
---|
765 |
|
---|
766 | qh_SEARCHdist
|
---|
767 | When is a facet coplanar with the best facet?
|
---|
768 | qh_findbesthorizon: all coplanar facets of the best facet need to be searched.
|
---|
769 |
|
---|
770 | See:
|
---|
771 | qh_DISToutside -- when is a point clearly outside of a facet
|
---|
772 | qh_SEARCHdist -- when is facet coplanar with the best facet?
|
---|
773 | qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
|
---|
774 | */
|
---|
775 | #define qh_SEARCHdist ((qh_USEfindbestnew ? 2 : 1) * \
|
---|
776 | (qh max_outside + 2 * qh DISTround + fmax_( qh MINvisible, qh MAXcoplanar)));
|
---|
777 |
|
---|
778 | /*-<a href="qh-user.htm#TOC"
|
---|
779 | >--------------------------------</a><a name="USEfindbestnew">-</a>
|
---|
780 |
|
---|
781 | qh_USEfindbestnew
|
---|
782 | Always use qh_findbestnew for qh_partitionpoint, otherwise use
|
---|
783 | qh_findbestnew if merged new facet or sharpnewfacets.
|
---|
784 |
|
---|
785 | See:
|
---|
786 | qh_DISToutside -- when is a point clearly outside of a facet
|
---|
787 | qh_SEARCHdist -- when is facet coplanar with the best facet?
|
---|
788 | qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
|
---|
789 | */
|
---|
790 | #define qh_USEfindbestnew (zzval_(Ztotmerge) > 50)
|
---|
791 |
|
---|
792 | /*-<a href="qh-user.htm#TOC"
|
---|
793 | >--------------------------------</a><a name="WIDEcoplanar">-</a>
|
---|
794 |
|
---|
795 | qh_WIDEcoplanar
|
---|
796 | n*MAXcoplanar or n*MINvisible for a WIDEfacet
|
---|
797 |
|
---|
798 | if vertex is further than qh.WIDEfacet from the hyperplane
|
---|
799 | then its ridges are not counted in computing the area, and
|
---|
800 | the facet's centrum is frozen.
|
---|
801 |
|
---|
802 | notes:
|
---|
803 | qh.WIDEfacet= max(qh.MAXoutside,qh_WIDEcoplanar*qh.MAXcoplanar,
|
---|
804 | qh_WIDEcoplanar * qh.MINvisible);
|
---|
805 | */
|
---|
806 | #define qh_WIDEcoplanar 6
|
---|
807 |
|
---|
808 | /*-<a href="qh-user.htm#TOC"
|
---|
809 | >--------------------------------</a><a name="MAXnarrow">-</a>
|
---|
810 |
|
---|
811 | qh_MAXnarrow
|
---|
812 | max. cosine in initial hull that sets qh.NARROWhull
|
---|
813 |
|
---|
814 | notes:
|
---|
815 | If qh.NARROWhull, the initial partition does not make
|
---|
816 | coplanar points. If narrow, a coplanar point can be
|
---|
817 | coplanar to two facets of opposite orientations and
|
---|
818 | distant from the exact convex hull.
|
---|
819 |
|
---|
820 | Conservative estimate. Don't actually see problems until it is -1.0
|
---|
821 | */
|
---|
822 | #define qh_MAXnarrow -0.99999999
|
---|
823 |
|
---|
824 | /*-<a href="qh-user.htm#TOC"
|
---|
825 | >--------------------------------</a><a name="WARNnarrow">-</a>
|
---|
826 |
|
---|
827 | qh_WARNnarrow
|
---|
828 | max. cosine in initial hull to warn about qh.NARROWhull
|
---|
829 |
|
---|
830 | notes:
|
---|
831 | this is a conservative estimate.
|
---|
832 | Don't actually see problems until it is -1.0. See qh-impre.htm
|
---|
833 | */
|
---|
834 | #define qh_WARNnarrow -0.999999999999999
|
---|
835 |
|
---|
836 | /*-<a href="qh-user.htm#TOC"
|
---|
837 | >--------------------------------</a><a name="ZEROdelaunay">-</a>
|
---|
838 |
|
---|
839 | qh_ZEROdelaunay
|
---|
840 | a zero Delaunay facet occurs for input sites coplanar with their convex hull
|
---|
841 | the last normal coefficient of a zero Delaunay facet is within
|
---|
842 | qh_ZEROdelaunay * qh.ANGLEround of 0
|
---|
843 |
|
---|
844 | notes:
|
---|
845 | qh_ZEROdelaunay does not allow for joggled input ('QJ').
|
---|
846 |
|
---|
847 | You can avoid zero Delaunay facets by surrounding the input with a box.
|
---|
848 |
|
---|
849 | Use option 'PDk:-n' to explicitly define zero Delaunay facets
|
---|
850 | k= dimension of input sites (e.g., 3 for 3-d Delaunay triangulation)
|
---|
851 | n= the cutoff for zero Delaunay facets (e.g., 'PD3:-1e-12')
|
---|
852 | */
|
---|
853 | #define qh_ZEROdelaunay 2
|
---|
854 |
|
---|
855 | #endif /* qh_DEFuser */
|
---|
856 |
|
---|
857 |
|
---|
858 |
|
---|