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

📄 global.c

📁 Quick hull implementation
💻 C
📖 第 1 页 / 共 5 页
字号:
	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 ("Gpoints", NULL, NULL);
	  qh PRINTcoplanar= True;
	  break;
	case 'r':
          qh_option ("Gridges", NULL, NULL);
	  qh PRINTridges= True;
	  break;
	case 't':
          qh_option ("Gtransparent", NULL, NULL);
	  qh PRINTtransparent= 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 option 'GDn'\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;
    case 'P':
      while (*s && !isspace(*s)) {
	switch(*s++) {
	case 'd': case 'D':  /* see qh_initthresholds() */
	  key= s[-1];
	  i= qh_strtol (s, &s);
	  r= 0;
	  if (*s == ':') {
	    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 facet count for keep area option 'PAn'\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 facet area for option 'PFn'\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 merge count for option 'PMn'\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[0]);
	  while (*++s && !isspace(*s));
	  break;
	}
      }
      break;
    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 SCALEinput= True;
	    qh_option ("QbBound-unit-box", NULL, &r);
	    break;
	  }
	  if (key == 'b' && *s == 'b') {
	    s++;
	    qh SCALElast= True;
	    qh_option ("Qbbound-last", NULL, NULL);
	    break;
	  }
	  k= qh_strtol (s, &s);
	  r= 0.0;
	  wasproject= False;
	  if (*s == ':') {
	    s++;
	    if ((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 ("Qinterior-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 't':
	  qh_option ("Qtriangulate", NULL, NULL);
	  qh TRIangulate= True;
	  break;
	case 'T':
	  qh_option ("QTestPoints", NULL, NULL);
	  if (!isdigit (*s))
	    fprintf (qh ferr, "qhull input error: missing number of test points for option 'QTn'\n");
	  else {
  	    qh TESTpoints= qh_strtol (s, &s);
            qh_option ("QTestPoints", &qh TESTpoints, NULL);
          }
	  break;
	case 'u':
	  qh_option ("QupperDelaunay", NULL, NULL);
	  qh UPPERdelaunay= True;
	  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;
	  break;
	case 'z':
	  qh_option ("Qz-infinity-point", NULL, NULL);
	  qh ATinfinity= True;
	  break;
	case '0':
	  qh_option ("Q0-no-premerge", NULL, NULL);
	  qh NOpremerge= True;
	  break;
	case '1':
	  if (!isdigit(*s)) {
	    qh_option ("Q1-no-angle-sort", NULL, NULL);
	    qh ANGLEmerge= False;
	    break; 
	  }
	  switch(*s++) {
  	  case '0':
	    qh_option ("Q10-no-narrow", NULL, NULL);
	    qh NOnarrow= True;
	    break; 
  	  case '1':
	    qh_option ("Q11-trinormals Qtriangulate", NULL, NULL);
	    qh TRInormals= True;
	    qh TRIangulate= True;
	    break; 
	  default:
	    s--;
	    fprintf (qh ferr, "qhull warning: unknown 'Q' qhull option 1%c, rest ignored\n", (int)s[0]);
	    while (*++s && !isspace(*s));
	    break;
	  }
	  break;
	case '2':
	  qh_option ("Q2-no-merge-independent", NULL, NULL);
	  qh MERGEindependent= False;
	  goto LABELcheckdigit;
	  break; /* no warnings */
	case '3':
	  qh_option ("Q3-no-merge-vertices", NULL, NULL);
	  qh MERGEvertices= False;
	LABELcheckdigit:
	  if (isdigit(*s))
	    fprintf (qh ferr, "qhull warning: can not follow '1', '2', or '3' with a digit.  '%c' skipped.\n",
	             *s++);
	  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 '9':
	  qh_option ("Q9-pick-furthest", NULL, NULL);
	  qh PICKfurthest= True;
	  break;
	case 'G':
	  i= qh_strtol (s, &t);
	  if (qh GOODpoint)
	    fprintf (qh ferr, "qhull warning: good point already defined for option 'QGn'.  Ignored\n");
          else if (s == t)
	    fprintf (qh ferr, "qhull warning: missing good point id 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 'J':
          if (!isdigit(*s) && *s != '-')
   	    qh JOGGLEmax= 0.0;
	  else {
 	    qh JOGGLEmax= (realT) qh_strtod (s, &s);
            qh_option ("QJoggle", NULL, &qh JOGGLEmax);
	  }
	  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 > 0)
   	      qh_option ("QRotate-id", &i, NULL );
	    else if (i < -1)
   	      qh_option ("QRandom-seed", &i, NULL );
          }
	  break;
	case 'V':
	  i= qh_strtol (s, &t);
	  if (qh GOODvertex)
	    fprintf (qh ferr, "qhull warning: good vertex already defined for option 'QVn'.  Ignored\n");
          else if (s == t)
	    fprintf (qh ferr, "qhull warning: no good point id given for option 'QVn'.  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:
	  s--;
	  fprintf (qh ferr, "qhull warning: unknown 'Q' qhull option %c, rest ignored\n", (int)s[0]);
	  while (*++s && !isspace(*s));
	  break;
	}
      }
      break;
    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':
	  if (!qh fout)
	    fprintf (qh ferr, "qhull warning: output file undefined (stdout).  Option 'Tz' ignored.\n");
	  else {
	    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: missing point id for cone for trace option 'TCn'.  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: missing frequency count for trace option 'TFn'.  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 'I':
	  if (s[0] != ' ' || s[1] == '\"' || s[1] == '\'' ||isspace (s[1])) {
	    s++;
	    fprintf (qh ferr, "qhull warning: option 'TI' mistyped.\nUse 'TI', one space, file name, and space or end-of-line.\nDo not use quotes.  Option 'FI' ignored.\n");

⌨️ 快捷键说明

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