67 printf(
"\n%d vertices and %d facets with normals:\n",
68 qh num_vertices,
qh num_facets);
70 for (k=0; k <
qh hull_dim; k++)
71 printf(
"%6.2g ", facet->
normal[k]);
84 for (j=0; j<numpoints; j++) {
85 point= points + j*
dim;
105 printf(
"seed: %d\n",
seed);
107 for (j=0; j<numpoints; j++) {
108 point= points + j*
dim;
109 for (k= 0; k <
dim; k++) {
133 for (k= 0; k <
dim; k++)
138 fprintf(stderr,
"findDelaunay: not implemented for triangulated, non-simplicial Delaunay regions (tricoplanar facet, f%d).\n",
143 for (k=0; k <
dim; k++)
144 printf(
"%5.2f ", vertex->
point[k]);
159 for (j=0; j<numpoints; j++) {
160 point= points + j*(
dim+1);
172 #define SIZEcube (1<<DIM)
173 #define SIZEdiamond (2*DIM)
174 #define TOTpoints (SIZEcube + SIZEdiamond)
185 int main(
int argc,
char *argv[]) {
192 FILE *outfile= stdout;
194 FILE *errfile= stderr;
197 int curlong, totlong;
202 printf(
"This is the output from user_eg.c\n\n\
203 It shows how qhull() may be called from an application using the qhull\n\
204 shared library. user_eg is not part of qhull itself. If it appears\n\
205 accidently, please remove user_eg.c from your project. If it fails\n\
206 immediately, user_eg.c was incorrectly linked to the reentrant library.\n\
207 Also try 'user_eg T1 2>&1'\n\n");
211 printf(
"QH6233: Qhull link error. The global variable qh_qh was not initialized\n\
212 to NULL by global.c. Please compile user_eg.c with -Dqh_QHpointer_dllimport\n\
213 as well as -Dqh_QHpointer, or use libqhullstatic, or use a different tool chain.\n\n");
221 printf(
"\ncompute convex hull of cube after rotating input\n");
222 sprintf(flags,
"qhull s Tcv %s", argc >= 2 ? argv[1] :
"");
225 for (i=numpoints; i--; )
229 flags, outfile, errfile);
239 if (curlong || totlong)
240 fprintf(errfile,
"qhull internal warning (user_eg, #1): did not free %d bytes of long memory (%d pieces)\n", totlong, curlong);
246 printf(
"\ncompute %d-d Delaunay triangulation\n",
dim);
247 sprintf(flags,
"qhull s d Tcv %s", argc >= 3 ? argv[2] :
"");
250 for (i=numpoints; i--; )
254 flags, outfile, errfile);
263 printf(
"\nfind %d-d Delaunay triangle closest to [0.5, 0.5, ...]\n",
dim);
264 exitcode= setjmp(
qh errexit);
275 qhT *oldqhA, *oldqhB;
278 printf(
"\nsave first triangulation and compute a new triangulation\n");
279 oldqhA= qh_save_qhull();
280 sprintf(flags,
"qhull s d Tcv %s", argc >= 3 ? argv[2] :
"");
283 for (i=numpoints; i--; )
287 flags, outfile, errfile);
290 printf(
"\nsave second triangulation and restore first one\n");
291 oldqhB= qh_save_qhull();
292 qh_restore_qhull(&oldqhA);
294 printf(
"\nfree first triangulation and restore second one.\n");
297 qh_restore_qhull(&oldqhB);
303 if (curlong || totlong)
304 fprintf(errfile,
"qhull internal warning (user_eg, #2): did not free %d bytes of long memory (%d pieces)\n", totlong, curlong);
309 printf(
"\ncompute halfspace intersection about the origin for a diamond\n");
310 sprintf(flags,
"qhull H0 s Tcv %s", argc >= 4 ? argv[3] :
"Fp");
313 for (i=numpoints; i--; )
320 flags, outfile, errfile);
325 if (curlong || totlong)
326 fprintf(stderr,
"qhull internal warning (user_eg, #3): did not free %d bytes of long memory (%d pieces)\n",