⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.c

📁 这是一个新的用于图像处理的工具箱
💻 C
📖 第 1 页 / 共 3 页
字号:
        case 'v':          qh_option ("Fvertices", NULL, NULL);          qh_appendprint (qh_PRINTvertices);          break;        case 'V':          qh_option ("FVertex-average", NULL, NULL);          qh_appendprint (qh_PRINTaverage);          break;	default:	  s--;	  fprintf (qh ferr, "qhull warning: unknown 'F' output option %c, rest ignored\n", (int)s[-1]);	  while (*++s && !isspace(*s));	  break;	}      }      break;#pragma mark option_G    case 'G':      isgeom= True;      qh_appendprint (qh_PRINTgeom);      while (*s && !isspace(*s)) {	switch(*s++) {        case 'a':          qh_option ("Gall-points", NULL, NULL);          qh PRINTdots= True;          break;        case 'c':          qh_option ("Gcentrums", NULL, NULL);          qh PRINTcentrums= True;          break;	case 'h':          qh_option ("Gintersections", NULL, NULL);	  qh DOintersections= True;	  break;	case 'i':          qh_option ("Ginner", NULL, NULL);	  qh PRINTinner= True;	  break;	case 'n':          qh_option ("Gno-planes", NULL, NULL);	  qh PRINTnoplanes= True;	  break;	case 'o':          qh_option ("Gouter", NULL, NULL);	  qh PRINTouter= True;	  break;	case 'p':          qh_option ("Gcoplanar", NULL, NULL);	  qh PRINTcoplanar= True;	  break;	case 'r':          qh_option ("Gridges", NULL, NULL);	  qh PRINTridges= True;	  break;	case 'v':          qh_option ("Gvertices", NULL, NULL);	  qh PRINTspheres= True;	  break;	case 'D':	  if (!isdigit (*s))	    fprintf (qh ferr, "qhull input error: missing dimension for 'GD' option\n");	  else {	    if (qh DROPdim >= 0)	      fprintf (qh ferr, "qhull warning: can only drop one dimension.  Previous 'GD%d' ignored\n",	           qh DROPdim);  	    qh DROPdim= qh_strtol (s, &s);            qh_option ("GDrop-dim", &qh DROPdim, NULL);          }	  break;	default:	  s--;	  fprintf (qh ferr, "qhull warning: unknown 'G' print option %c, rest ignored\n", (int)s[0]);	  while (*++s && !isspace(*s));	  break;	}      }      break;#pragma mark option_P    case 'P':      while (*s && !isspace(*s)) {	switch(*s++) {	case 'd': case 'D':	  key= s[-1];	  i= qh_strtol (s, &s);	  r= 0;	  if (*s == ':') 	    r= qh_strtod (++s, &s);	  if (key == 'd')  	    qh_option ("Pdrop-facets-dim-less", &i, &r);  	  else  	    qh_option ("PDrop-facets-dim-more", &i, &r);	  break;        case 'g':          qh_option ("Pgood-facets", NULL, NULL);          qh PRINTgood= True;          break;        case 'G':          qh_option ("PGood-facet-neighbors", NULL, NULL);          qh PRINTneighbors= True;          break;        case 'o':          qh_option ("Poutput-forced", NULL, NULL);          qh FORCEoutput= True;          break;        case 'p':          qh_option ("Pprecision-ignore", NULL, NULL);          qh PRINTprecision= False;          break;	case 'A':	  if (!isdigit (*s))	    fprintf (qh ferr, "qhull input error: missing count for 'PA' option\n");	  else {  	    qh KEEParea= qh_strtol (s, &s);            qh_option ("PArea-keep", &qh KEEParea, NULL);            qh GETarea= True;          }	  break;	case 'F':	  if (!isdigit (*s))	    fprintf (qh ferr, "qhull input error: missing area for 'PF' option\n");	  else {  	    qh KEEPminArea= qh_strtod (s, &s);            qh_option ("PFacet-area-keep", NULL, &qh KEEPminArea);            qh GETarea= True;          }	  break;	case 'M':	  if (!isdigit (*s))	    fprintf (qh ferr, "qhull input error: missing count for 'PM' option\n");	  else {  	    qh KEEPmerge= qh_strtol (s, &s);            qh_option ("PMerge-keep", &qh KEEPmerge, NULL);          }	  break;	default:	  s--;	  fprintf (qh ferr, "qhull warning: unknown 'P' print option %c, rest ignored\n", (int)s[-1]);	  while (*++s && !isspace(*s));	  break;	}      }      break;#pragma mark option_Q    case 'Q':      lastproject= -1;      while (*s && !isspace(*s)) {	switch(*s++) {	case 'b': case 'B':  /* handled by qh_initthresholds */	  key= s[-1];	  if (key == 'b' && *s == 'B') {	    s++;	    r= qh_DEFAULTbox;	    qh_option ("QbBound-unit-box", NULL, &r);	    break;	  }	  k= qh_strtol (s, &s);	  r= 0.0;	  wasproject= False;	  if (*s == ':' && (r= qh_strtod(++s, &s)) == 0.0) {	    t= s;            /* need true dimension for memory allocation */	    while (*t && !isspace(*t)) {	      if (toupper(*t++) == 'B' 	       && k == qh_strtol (t, &t)	       && *t++ == ':'	       && qh_strtod(t, &t) == 0.0) {	        qh PROJECTinput++;	        trace2((qh ferr, "qh_initflags: project dimension %d\n", k));	        qh_option ("Qb-project-dim", &k, NULL);		wasproject= True;	        lastproject= k;	        break;	      }	    }  	  }	  if (!wasproject) {	    if (lastproject == k && r == 0.0) 	      lastproject= -1;  /* doesn't catch all possible sequences */	    else if (key == 'b') {	      qh SCALEinput= True;	      if (r == 0.0)		r= -qh_DEFAULTbox;	      qh_option ("Qbound-dim-low", &k, &r);	    }else {	      qh SCALEinput= True;	      if (r == 0.0)		r= qh_DEFAULTbox;	      qh_option ("QBound-dim-high", &k, &r);	    }	  }	  break;	case 'c':	  qh_option ("Qcoplanar-keep", NULL, NULL);	  qh KEEPcoplanar= True;	  break;	case 'f':	  qh_option ("Qfurthest-outside", NULL, NULL);	  qh BESToutside= True;	  break;	case 'g':	  qh_option ("Qgood-facets-only", NULL, NULL);	  qh ONLYgood= True;	  break;	case 'i':	  qh_option ("Qinside-keep", NULL, NULL);	  qh KEEPinside= True;	  break;	case 'm':	  qh_option ("Qmax-outside-only", NULL, NULL);	  qh ONLYmax= True;	  break;	case 'r':	  qh_option ("Qrandom-outside", NULL, NULL);	  qh RANDOMoutside= True;	  break;	case 's':	  qh_option ("Qsearch-initial-simplex", NULL, NULL);	  qh ALLpoints= True;	  break;	case 'u':	  qh_option ("QupperHull", NULL, NULL);	  qh ATinfinity= False;	  break;	case 'v':	  qh_option ("Qvertex-neighbors-convex", NULL, NULL);	  qh TESTvneighbors= True;	  break;	case 'x':	  qh_option ("Qxact-merge", NULL, NULL);	  qh MERGEexact= True;	  qh MERGING= True;	  break;	case '1':	  qh_option ("Q1-no-angle-sort", NULL, NULL);	  qh ANGLEmerge= False;	  goto LABELcheckdigit;	case '2':	  qh_option ("Q2-no-merge-independent", NULL, NULL);	  qh MERGEindependent= False;	LABELcheckdigit:	  if (isdigit(*s)) 	    fprintf (qh ferr, "qhull warning: can not follow '1' or '2' with a digit.  '%c' skipped.\n",	             *s++);	  break;	case '3':	  qh_option ("Q3-no-merge-vertices", NULL, NULL);	  qh MERGEvertices= False;	  break;	case '4':	  qh_option ("Q4-avoid-old-into-new", NULL, NULL);	  qh AVOIDold= True;	  break;	case '5':	  qh_option ("Q5-no-check-outer", NULL, NULL);	  qh SKIPcheckmax= True;	  break;	case '6':	  qh_option ("Q6-no-concave-merge", NULL, NULL);	  qh SKIPconvex= True;	  break;	case '7':	  qh_option ("Q7-no-breadth-first", NULL, NULL);	  qh VIRTUALmemory= True;	  break;	case '8':	  qh_option ("Q8-no-near-inside", NULL, NULL);	  qh NOnearinside= True;	  break;	case 'G':	  i= qh_strtol (s, &t);	  if (qh GOODpoint) 	    fprintf (qh ferr, "qhull warning: good point already defined for QGn.  Ignored\n");          else if (s == t)	    fprintf (qh ferr, "qhull warning: no good point id given for option QGn.  Ignored\n");	  else if (i < 0 || *s == '-') {  	    qh GOODpoint= i-1;  	    qh_option ("QGood-if-dont-see-point", &i, NULL);	  }else { 	    qh GOODpoint= i+1;  	    qh_option ("QGood-if-see-point", &i, NULL);  	  } 	  s= t;	  break;	case 'R':          if (!isdigit(*s) && *s != '-')	    fprintf (qh ferr, "qhull warning: missing random seed for option QRn.  Ignored\n");	  else { 	    qh ROTATErandom= i= qh_strtol(s, &s); 	    if (i == -1)   	      qh_option ("QRandom-seed", NULL, NULL );   	    else if (i > 0)   	      qh_option ("QRotate-id", &i, NULL );          }	  break;	case 'V':	  i= qh_strtol (s, &t);	  if (qh GOODvertex) 	    fprintf (qh ferr, "qhull warning: good vertex already defined for QV.  Ignored\n");          else if (s == t)	    fprintf (qh ferr, "qhull warning: no good point id given for QV.  Ignored\n");	  else if (i < 0) { 	    qh GOODvertex= i - 1; 	    qh_option ("QV-good-facets-not-point", &i, NULL);	  }else {  	    qh_option ("QV-good-facets-point", &i, NULL);	    qh GOODvertex= i + 1;          } 	  s= t;	  break;	default:	  fprintf (qh ferr, "qhull warning: unknown 'Q' qhull option %c, rest ignored\n", (int)s[-1]);	  while (*++s && !isspace(*s));	  break;	}      }      break;#pragma mark option_T    case 'T':      while (*s && !isspace(*s)) {	if (isdigit(*s) || *s == '-')	  qh IStracing= qh_strtol(s, &s);	else switch(*s++) {	case 'c':          qh_option ("Tcheck-frequently", NULL, NULL);	  qh CHECKfrequently= True;	  break;	case 's':          qh_option ("Tstatistics", NULL, NULL);	  qh PRINTstatistics= True;	  break;	case 'v':          qh_option ("Tverify", NULL, NULL);	  qh VERIFYoutput= True;	  break;	case 'z':          qh_option ("Tz-stdout", NULL, NULL);	  qh ferr= qh fout;	  qhmem.ferr= qh fout;	  break;	case 'C':	  if (!isdigit(*s))	    fprintf (qh ferr, "qhull warning: no point given for trace option C.  Ignored\n");	  else {	    i= qh_strtol (s, &s);	    qh_option ("TCone-stop", &i, NULL);	    qh STOPcone= i + 1;          }	  break;	case 'F':	  if (!isdigit(*s))	    fprintf (qh ferr, "qhull warning: no count of new facets for trace option P.  Ignored\n");	  else {	    qh REPORTfreq= qh_strtol (s, &s);            qh_option ("TFacet-log", &qh REPORTfreq, NULL);	    qh REPORTfreq2= qh REPORTfreq/2;  /* for tracemerging() */	  }	  break;	case 'P':	  if (!isdigit(*s))	    fprintf (qh ferr, "qhull warning: no point given for trace option P.  Ignored\n");	  else {	    qh TRACEpoint= qh_strtol (s, &s);            qh_option ("Trace-point", &qh TRACEpoint, NULL);          }	  break;	case 'M':	  if (!isdigit(*s))	    fprintf (qh ferr, "qhull warning: no merge given for trace option M.  Ignored\n");	  else {	    qh TRACEmerge= qh_strtol (s, &s);            qh_option ("Trace-merge", &qh TRACEmerge, NULL);          }	  break;	case 'V':	  i= qh_strtol (s, &t);	  if (s == t)	    fprintf (qh ferr, "qhull warning: no point given for trace option V.  Ignored\n");	  else if (i < 0) {	    qh STOPpoint= i - 1;            qh_option ("TV-stop-before-point", &i, NULL);	  }else {	    qh STOPpoint= i + 1;            qh_option ("TV-stop-after-point", &i, NULL);          }          s= t;	  break;	case 'W':	  if (!isdigit(*s))	    fprintf (qh ferr, "qhull warning: no max width given for trace option D.  Ignored\n");	  else { 	    qh TRACEdist= (realT) qh_strtod (s, &s);            qh_option ("TWide-trace", NULL, &qh TRACEdist);          }	  break;	default:	  fprintf (qh ferr, "qhull warning: unknown 'T' trace option %c, rest ignored\n", (int)s[-1]);	  while (*++s && !isspace(*s));	  break;	}      }      break;    default:      fprintf (qh ferr, "qhull warning: unknown flag %c (%x)\n", (int)s[-1],	       (int)s[-1]);      break;    }    if (s-1 == prev_s && *s && !isspace(*s)) {      fprintf (qh ferr, "qhull warning: missing space after flag %c (%x); reserved for menu. Skipped.\n",	       (int)*prev_s, (int)*prev_s);      while (*s && !isspace(*s))	s++;    }  }  if (isgeom && !qh FORCEoutput && qh PRINTout[1])    fprintf (qh ferr, "qhull warning: additional output formats are not compatible with Geomview\n");  /* set derived values in qh_initqhull_globals */} /* initflags *//*--------------------------------------------initqhull_buffers- initialize global memory buffers  must match freebuffers()*/void qh_initqhull_buffers (void) {  int k;  qh TEMPsize= (qhmem.LASTsize - sizeof (setT))/SETelemsize;  if (qh TEMPsize <= 0 || qh TEMPsize > qhmem.LASTsize)    qh TEMPsize= 8;  /* e.g., if qh_NOmem */  qh other_points= qh_setnew (qh TEMPsize);  qh del_vertices= qh_setnew (qh TEMPsize);  qh searchset= qh_setnew (qh TEMPsize);  qh NEARzero= (realT *)qh_memalloc(qh hull_dim * sizeof(realT));  qh lower_threshold= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));  qh upper_threshold= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));  qh lower_bound= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));  qh upper_bound= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));  for(k= qh input_dim+1; k--; ) {    qh lower_threshold[k]= -REALmax;    qh upper_threshold[k]= REALmax;    qh lower_bound[k]= -REALmax;    qh upper_bound[k]= REALmax;  }  qh gm_matrix= (coordT *)qh_memalloc((qh hull_dim+1) * qh hull_dim * sizeof(coordT));  qh gm_row= (coordT **)qh_memalloc((qh hull_dim+1) * sizeof(coordT *));} /* initqhull_buffers *//*----------------------------------------------initqhull_globals- initialize globals  ismalloc set if points were malloc'd and qhull should free at endreturns:  sets qh first_point, num_points, input_dim, hull_dim and others  modifies hull_dim if ((DELAUNAY and PROJECTdelaunay) or PROJECTinput)  seeds random number generator (seed=1 if tracing)  adjust user flags as needed  also checks hull_dim dependencies and constants*/void qh_initqhull_globals (coordT *points, int numpoints, int dim, boolT ismalloc) {  int seed, pointsneeded, extra= 0, i, randi, k;  boolT printgeom= False, printmath= False;  realT randr;  realT factorial;    time_t timedata;  trace0((qh ferr, "qh_initqhull_globals: for %s | %s\n", qh rbox_command,       qh qhull_command));  qh POINTSmalloc= ismalloc;  qh first_point= points;  qh num_points= numpoints;  qh hull_dim= qh input_dim= dim;#ifdef qh_NOmerge  if (qh MERGING) {    fprintf (qh ferr, "qhull input error: merging not installed (qh_NOmerge + 'Qx', 'Cn' or 'An')\n");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -