• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Evaluate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Evaluate函数的典型用法代码示例。如果您正苦于以下问题:C++ Evaluate函数的具体用法?C++ Evaluate怎么用?C++ Evaluate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Evaluate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ClearScreen

//----------------------------------------------------------------------------
void QuadraticFreeForm2D::OnDisplay ()
{
    ClearScreen();

    int dim0 = mTexture->GetDimension(0, 0);
    int dim1 = mTexture->GetDimension(1, 0);
    unsigned char* data = (unsigned char*)mTexture->GetData(0);

    const int numSamples = 2*mSize;
    const float invNumSamples = 1.0f/(float)numSamples;
    Vector2f param;
    for (int s = 0; s < numSamples; ++s)
    {
        int u = s*dim0/numSamples;
        param.X() = invNumSamples*s;
        for (int t = 0; t < numSamples; ++t)
        {
            int v = t*dim1/numSamples;
            param.Y() = invNumSamples*t;
            Vector2f result = Evaluate(param);

            int x = ControlToScreen(result.X());
            int y = ControlToScreen(result.Y());
            int index = 4*(u + dim0*v);
            unsigned char b = data[index++];
            unsigned char g = data[index++];
            unsigned char r = data[index++];
            ++index;

            SetPixel(x, y, ColorRGB(r, g, b));
        }
    }

    // Draw the control points.
    ColorRGB green(0, 255, 0);
    for (int row = 0; row <= 2; ++row)
    {
        for (int col = 0; col <= 2; ++col)
        {
            SetThickPixel(mCtrlX[row][col], mCtrlY[row][col], 2, green);
        }
    }

    WindowApplication2::OnDisplay();
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:46,代码来源:QuadraticFreeForm2D.cpp


示例2: AlphaBeta

int AlphaBeta(board state, int depth, int alpha, int beta, int player, int *
        bestX, int * bestY)	//AlphaBeta
{
    int X,Y, numacts, i, value;
    int Xacts[64], Yacts[64];	//maximum of 64 (actually 60) possible moves
    board child;

    if (timelimit1){
        currenttime = clock();
        if (deadline < currenttime) return 0;
    }

    if (CutoffTest(state, depth)) return Evaluate(state);
    numacts = Actions(state, player, Xacts, Yacts);

    if (player == 1){//the MAX player (us)
        for (i=0; i<numacts; i++) {
            Result(state, child, player, Xacts[i], Yacts[i]);
            value = AlphaBeta(child, depth-1, alpha, beta, -player, &X, &Y);
            if (timelimit1 && deadline < currenttime) return 0;
            //checking if we've reached the timelimit if applicable
            if (value > alpha) {
                alpha = value;
                *bestX = Xacts[i]; *bestY = Yacts[i];
            }
            if (beta <= alpha)//beta cut-off
                break;
        }
        return alpha;
    } else {
        for (i=0; i<numacts; i++) {
            Result(state, child, player, Xacts[i], Yacts[i]);
            value = AlphaBeta(child, depth-1, alpha, beta, -player, &X, &Y);
            if (timelimit1 && deadline < currenttime) return 0;
            //checking if we've reached the time limit if applicable
            if (value < beta) {
                beta = value;
                *bestX = Xacts[i]; *bestY = Yacts[i];
            }
            if (beta <= alpha)//alpha cutoff
                break;
        }
        return beta;
    }
}
开发者ID:jeremywrnr,项目名称:cxref.rb,代码行数:45,代码来源:windows.c


示例3: Evaluate

bool DistanceEstimator::DoesIntersect(const Ray &r, float *tHit) const {
  Ray ray;
  (*WorldToObject)(r, &ray);
  float t = ray.mint;
  bool intersected = false;
  for (int itr = 0; ray.mint <= t && t <= ray.maxt && itr < DE_params.maxIters; itr++) {
    float dist = Evaluate(ray(t));
    if (fabs(dist) < DE_params.hitEpsilon) {
      intersected = true;
      break;
    }
    t += dist;
  }
  if (!intersected || t < ray.mint || t > ray.maxt) 
    return false;
  if (tHit) *tHit = t;
  return true;
}
开发者ID:csimstu,项目名称:pbrt-v2,代码行数:18,代码来源:distanceestimator.cpp


示例4: msgBox

void MainWindow::ReportJackpotFileDownloaded()
{
    if (!UpdateJackpots()) {
        QMessageBox msgBox(this);
        msgBox.setText("That does not appear to be a valid table. Jackpots file is invalid.");
        msgBox.exec();
        ui->tableName->setEnabled(true);
        ui->table_instructions->show();
        return;
    }
    if (m_gamestate == Login) {
        SetupMoney();
    }
    else if (m_gamestate == WaitingForPayout) {
        // let's try once more to make a payout, but with the new jackpot amounts
        Evaluate();
    }
}
开发者ID:kingsawyer,项目名称:BoxPoker,代码行数:18,代码来源:mainwindow.cpp


示例5: SetTypeGV

size_w SetTypeGV(HWND hwndGridView, HGRIDITEM hItem, TypeDecl *typeDecl, size_w dwOffset)
{
	if(typeDecl->typeAlias == true)
		return dwOffset;

	if(typeDecl->declList.size() > 0)
	{
		Type *type = typeDecl->declList[0];
		ExprNode *offsetExpr;

		if(FindTag(typeDecl->tagList, TOK_OFFSET, &offsetExpr))
			dwOffset = Evaluate(offsetExpr);
			
		dwOffset += RecurseType(hwndGridView, hItem, type, dwOffset, typeDecl);
	}
	
	return dwOffset;
}
开发者ID:4aiman,项目名称:HexEdit,代码行数:18,代码来源:TypeViewGui.cpp


示例6: StdoutFn

Value *
StdoutFn (const char *name, State * state, int argc, Expr * argv[])
{
  int i;

  for (i = 0; i < argc; ++i)
	  {
	    char *v = Evaluate (state, argv[i]);

	    if (v == NULL)
		    {
		      return NULL;
		    }
	    fputs (v, stdout);
	    free (v);
	  }
  return StringValue (strdup (""));
}
开发者ID:ProjectOpenCannibal,项目名称:RZrecovery,代码行数:18,代码来源:expr.c


示例7: strtod

int ParameterScalar::SetValue(const string value, bool Eval)
{
	if (value.empty()) return -1;

	//check if string is only a plain double
	char *pEnd;
	double val = strtod(value.c_str(),&pEnd);
	if (*pEnd == 0)
		SetValue(val);

	ParameterMode=true;
	bModified=true;
	sValue=value;

	if (Eval) return Evaluate();

	return 0;
}
开发者ID:koendv,项目名称:CSXCAD,代码行数:18,代码来源:ParameterObjects.cpp


示例8: EvalSubStatement

double EvalSubStatement (char *status, char *look, struct Variable *Vars) {
#ifdef DEBUG
	printf ("EvalSubStatement in; status: %i, look: %c;\n", *status, *look);
#endif
	char oldstatus = *status;
	*status = -1;					// pass on substatement status
	
	struct TokenStruct tmp;
//	tmp.Token = malloc (sizeof (char) * 2);
	tmp.Token = "+";
	tmp.type = TokenType ('+');
	tmp.priority = OpPriority ('+');
	
	double ret = Evaluate (0, tmp, status, look, Vars);
	if (!*status) { *status = oldstatus; }	// if no error occured during substatement evaluation, reset status

	return ret;
}
开发者ID:TAParsons,项目名称:HomebrewCalculator,代码行数:18,代码来源:Calculator.c


示例9: Evaluate

/*MATH_EXPRESSION FUNCTION Evaluate: EVALUATES EVERY OCCURANCE OF THE OPERATION*/
void MATH_EXPRESSION::Evaluate(int op1, int op2) {
  if( (op1==op)||(op2==op) ) {
    //Evaluate mathematical operation
    if(op=='^') {number = pow(number, next->number);} else
    if(op=='*') {number = number * next->number;} else
    if(op=='/') {number = number / next->number;} else
    if(op=='+') {number = number + next->number;} else
    if(op=='-') {number = number - next->number;} else
    {Log <<"Operation: "<<op<<" is undefined."<<endl;}
    //Reduce linked list by copying numbers and operators down one
    op = next->op;
    if(next->next==NULL) {
      delete next;
      next=NULL;
      return;
    }
    next->Copy();
    Evaluate(op1, op2);
  }
  if(next!=NULL) {next->Evaluate(op1, op2);}
  return;


  /*if(_op==op) {
    //Evaluate mathematical operation
    if(op=='^') {number = pow(number, next->number);} else
    if(op=='*') {number = number * next->number;} else
    if(op=='/') {number = number / next->number;} else
    if(op=='+') {number = number + next->number;} else
    if(op=='-') {number = number - next->number;} else
    {Log <<"Operation: "<<op<<" is undefined."<<endl;}
    //Reduce linked list by copying numbers and operators down one
    op = next->op;
    if(next->next==NULL) {
      delete next;
      next=NULL;
      return;
    }
    next->Copy();
    Evaluate(_op);
  }
  if(next!=NULL) {next->Evaluate(_op);}
  return;*/
}
开发者ID:jasonlarkin,项目名称:ald-si,代码行数:45,代码来源:Variables.cpp


示例10: expect

int expect(const char* expr_str, const char* expected, int* errors) {
    Expr* e;
    char* result;

    printf(".");

    int error_count = parse_string(expr_str, &e, &error_count);
    if (error_count > 0) {
        fprintf(stderr, "error parsing \"%s\" (%d errors)\n",
               expr_str, error_count);
        ++*errors;
        return 0;
    }

    State state;
    state.cookie = NULL;
    state.script = strdup(expr_str);
    state.errmsg = NULL;

    result = Evaluate(&state, e);
    free(state.errmsg);
    free(state.script);
    if (result == NULL && expected != NULL) {
        fprintf(stderr, "error evaluating \"%s\"\n", expr_str);
        ++*errors;
        return 0;
    }

    if (result == NULL && expected == NULL) {
        return 1;
    }

    if (strcmp(result, expected) != 0) {
        fprintf(stderr, "evaluating \"%s\": expected \"%s\", got \"%s\"\n",
               expr_str, expected, result);
        ++*errors;
        free(result);
        return 0;
    }

    free(result);
    return 1;
}
开发者ID:bju2000,项目名称:MT6797,代码行数:43,代码来源:main.c


示例11: Initialize

int PhaseFit::LevMarFit(int max_iter, int nParam, float *params) {
  unsigned int nRead = signal.size();
  int nData = nRead * nFlow;

  // Call LevMarFitter::Initialize() - the 3rd arg is null as we don't need access to
  // the LevMarFitter's internal x array in the calls to Evaluate
  Initialize(nParam,nData,NULL);

  // Update LevMarFitter::residualWeight array if we are using flow-specific weighting or
  // if we are ignoring homopolymers of size > 1
  if( (!ignoreHPs) || (flowWeight.size() > 0) || (hpWeight.size() > 0) )
    updateResidualWeight(ignoreHPs, flowWeight, hpWeight);

  // Gather the observed data into an array of floats
  float *y   = new float[nData];
  unsigned int iY=0;
  for(unsigned int iRead=0; iRead<nRead; iRead++)
    for(unsigned int iFlow=0; iFlow<nFlow; iFlow++)
      y[iY++] = (float) signal[iRead][iFlow];

  err.resize(nData);
  int nIter = LevMarFitter::Fit(max_iter, y, params);

  // Store the (possibly weighted) residuals
  float *fval = new float[len];
  Evaluate(fval,params);
  residual_raw_vec.resize(nRead);
  residual_weighted_vec.resize(nRead);
  for(unsigned int iRead=0,iY=0; iRead<nRead; iRead++) {
    residual_raw_vec[iRead].resize(nFlow);
    residual_weighted_vec[iRead].resize(nFlow);
    for(unsigned int iFlow=0; iFlow<nFlow; iFlow++, iY++) {
      weight_t res = y[iY] - fval[iY];
      residual_raw_vec[iRead][iFlow] = res;
      residual_weighted_vec[iRead][iFlow] = residualWeight[iY] * res;
    }
  }
  delete [] fval;

  delete [] y;

  return(nIter);
}
开发者ID:Jorges1000,项目名称:TS,代码行数:43,代码来源:PhaseFit.cpp


示例12: AnimatedTranslateTransform2Impl

 AnimatedTranslateTransform2Impl(
     Number* ptime,
     RectValue* prect,
     int side,
     const Point& vecStart,
     const Point& vecEnd,
     float dtimeAnimation
 ) :
     AnimatedTranslateTransform2(ptime, prect),
     m_side(side),
     m_pointStart(vecStart),
     m_pointEnd(vecEnd),
     m_dtimeAnimation(dtimeAnimation),
     m_bGotoStart(true),
     m_bStationary(true),
     m_timeStart(ptime->GetValue() - dtimeAnimation)
 {
     Evaluate();
 }
开发者ID:kgersen,项目名称:Allegiance,代码行数:19,代码来源:trekctrls.cpp


示例13: SymlinkFn

// symlink target src1 src2 ...
//    unlinks any previously existing src1, src2, etc before creating symlinks.
Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) {
    if (argc == 0) {
        return ErrorAbort(state, "%s() expects 1+ args, got %d", name, argc);
    }
    char* target;
    target = Evaluate(state, argv[0]);
    if (target == NULL) return NULL;

    char** srcs = ReadVarArgs(state, argc-1, argv+1);
    if (srcs == NULL) {
        free(target);
        return NULL;
    }

    int bad = 0;
    int i;
    for (i = 0; i < argc-1; ++i) {
        if (unlink(srcs[i]) < 0) {
            if (errno != ENOENT) {
                fprintf(stderr, "%s: failed to remove %s: %s\n",
                        name, srcs[i], strerror(errno));
                ++bad;
            }
        }
        if (make_parents(srcs[i])) {
            fprintf(stderr, "%s: failed to symlink %s to %s: making parents failed\n",
                    name, srcs[i], target);
            ++bad;
        }
        if (symlink(target, srcs[i]) < 0) {
            fprintf(stderr, "%s: failed to symlink %s to %s: %s\n",
                    name, srcs[i], target, strerror(errno));
            ++bad;
        }
        free(srcs[i]);
    }
    free(srcs);
    if (bad) {
        return ErrorAbort(state, "%s: some symlinks failed", name);
    }
    return StringValue(strdup(""));
}
开发者ID:1998-yhf,项目名称:android_bootable_recovery,代码行数:44,代码来源:install.c


示例14: CalculateExpression

static void CalculateExpression(
    const std::shared_ptr<SyntaxNode>& expression_node,
    const std::shared_ptr<CalculateResult>& result, 
    std::int64_t& integer_value) {

    auto evaluator = CreateValueEvaluator(expression_node);
    if (evaluator == nullptr) {
        result->error = CalculateResult::Error::SemanticsError;
        return;
    }

    std::shared_ptr<Value> value;
    auto evaluate_status = evaluator->Evaluate(value);
    if (evaluate_status != EvaluateStatus::Ok) {
        result->error = CalculateResult::Error::SemanticsError;
        return;
    }
    
    integer_value = value->integer_value;
}
开发者ID:Zplutor,项目名称:zaf,代码行数:20,代码来源:calculator.cpp


示例15: AbortFn

Value *
AbortFn (const char *name, State * state, int argc, Expr * argv[])
{
  char *msg = NULL;

  if (argc > 0)
	  {
	    msg = Evaluate (state, argv[0]);
	  }
  free (state->errmsg);
  if (msg)
	  {
	    state->errmsg = msg;
	  }
  else
	  {
	    state->errmsg = strdup ("called abort()");
	  }
  return NULL;
}
开发者ID:ProjectOpenCannibal,项目名称:RZrecovery,代码行数:20,代码来源:expr.c


示例16: ActualTemplate

void TemplateDlg::Create()
{
	const PackageTemplate& tp = ActualTemplate();
	ArrayMap<String, EscValue> var = MakeVars();
	for(int i = 0; i < tp.file.GetCount(); i++) {
		const FileTemplate& ft = tp.file[i];
		if(IsNull(ft.condition) || IsTrue(Evaluate(ft.condition, var))) {
			String fn = Expand(ft.filename, var);
			if(!IsNull(fn)) {
				fn = AppendFileName(AppendFileName(~nest, (String)~package), fn);
				RealizePath(fn);
				SaveFile(fn, Expand(ft.text, var));
			}
		}
	}
	Package p;
	String f = AppendFileName(AppendFileName(~nest, (String)~package), (String)~package + ".upp");
	p.Load(f);
	p.description = ~description;
	p.Save(f);
}
开发者ID:kolyden,项目名称:mirror,代码行数:21,代码来源:Template.cpp


示例17: GetPropFn

Value *
GetPropFn (const char *name, State * state, int argc, Expr * argv[])
{
  if (argc != 1)
	  {
	    return ErrorAbort (state, "%s() expects 1 arg, got %d", name,
			       argc);
	  }
  char *key;

  key = Evaluate (state, argv[0]);
  if (key == NULL)
    return NULL;

  char value[PROPERTY_VALUE_MAX];

  property_get (key, value, "");
  free (key);

  return StringValue (strdup (value));
}
开发者ID:ProjectOpenCannibal,项目名称:RZrecovery,代码行数:21,代码来源:install.c


示例18: curve

void CEdge::GetGripperPositions(std::list<GripData> *list, bool just_for_endof){
	if(just_for_endof)
	{
		list->push_back(GripData(GripperTypeTranslate,m_start_x,m_start_y,m_start_z,NULL));
		list->push_back(GripData(GripperTypeTranslate,m_end_x,m_end_y,m_end_z,NULL));
	}
	else
	{
		// add a gripper in the middle, just to show the edge is selected
		if(!m_midpoint_calculated)
		{
			BRepAdaptor_Curve curve(m_topods_edge);
			double us = curve.FirstParameter();
			double ue = curve.LastParameter();
			double umiddle = (us+ue)/2;
			Evaluate(umiddle, m_midpoint, NULL);
		}

		list->push_back(GripData(GripperTypeTranslate,m_midpoint[0],m_midpoint[1],m_midpoint[2],NULL));
	}
}
开发者ID:Heeks,项目名称:heekscad,代码行数:21,代码来源:Edge.cpp


示例19: GetGrid

void LevelSetOperator::EulerStep(LevelSetGrid & gridOut,float dt)
{
// Iterate over grid and compute the grid values for the next timestep
	gridOut = GetGrid();
  LevelSetGrid::Iterator iter = GetGrid().BeginNarrowBand();
  LevelSetGrid::Iterator iend = GetGrid().EndNarrowBand();
  while (iter != iend) {
    unsigned int i = iter.GetI();
    unsigned int j = iter.GetJ();
    unsigned int k = iter.GetK();

    // Compute rate of change
    float ddt = Evaluate(i,j,k);

    // Compute the next time step and store it in the grid
    gridOut.SetValue(i,j,k, GetGrid().GetValue(i,j,k) + ddt*dt);

    iter++;
  }

}
开发者ID:jaschmid,项目名称:ModelingAnimationLab,代码行数:21,代码来源:LevelSetOperator.cpp


示例20: DeleteFn

Value *
DeleteFn (const char *name, State * state, int argc, Expr * argv[])
{
  char **paths = malloc (argc * sizeof (char *));
  int i;

  for (i = 0; i < argc; ++i)
	  {
	    paths[i] = Evaluate (state, argv[i]);
	    if (paths[i] == NULL)
		    {
		      int j;

		      for (j = 0; j < i; ++i)
			      {
				free (paths[j]);
			      }
		      free (paths);
		      return NULL;
		    }
	  }

  bool recursive = (strcmp (name, "delete_recursive") == 0);

  int success = 0;

  for (i = 0; i < argc; ++i)
	  {
	    if ((recursive ? dirUnlinkHierarchy (paths[i]) :
		 unlink (paths[i])) == 0)
	      ++success;
	    free (paths[i]);
	  }
  free (paths);

  char buffer[10];

  sprintf (buffer, "%d", success);
  return StringValue (strdup (buffer));
}
开发者ID:ProjectOpenCannibal,项目名称:RZrecovery,代码行数:40,代码来源:install.c



注:本文中的Evaluate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ EvaluationData函数代码示例发布时间:2022-05-30
下一篇:
C++ EvalWaveForm函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap