当前位置: 首页>>代码示例>>C++>>正文


C++ Curve::clear方法代码示例

本文整理汇总了C++中Curve::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Curve::clear方法的具体用法?C++ Curve::clear怎么用?C++ Curve::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Curve的用法示例。


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

示例1: step_learn

  void step_learn( int key )
  {
    // one input
    // Eigen::VectorXd i1 = Eigen::VectorXd::Random(1);
    // i1 = (i1.array() - -1.0) / (1.0 - -1.0);
	Eigen::VectorXd i1(1);
	i1 << (double) (_nb_iter % 3) / 4.0 + 0.1;
	
    _rdsom->forward( i1 );
    _rdsom->deltaW( i1, 0.1, 0.2, true );

    _c_weights.clear();
    _c_sim_input.clear();
    _c_sim_rec.clear();
    _c_sim_merged.clear();
    _c_sim_convol.clear();
	_c_sim_hn_dist.clear();
	_c_sim_hn_rec.clear();
    for( unsigned int i = 0; i < _rdsom->v_neur.size(); ++i) {
      _c_weights.add_sample( {(double)i, _rdsom->v_neur[i]->weights(0), 0.0} ); 
      _c_sim_input.add_sample( {(double)i, _rdsom->_sim_w[i], 0.0} );
      _c_sim_rec.add_sample( {(double)i, _rdsom->_sim_rec[i], 0.0} );
      _c_sim_merged.add_sample( {(double)i, _rdsom->_sim_merged[i], 0.0} );
      _c_sim_convol.add_sample( {(double)i, _rdsom->_sim_convol[i], 0.0} );
	  _c_sim_hn_dist.add_sample( {(double)i, _rdsom->_sim_hn_dist[i], 0.0} );
	  _c_sim_hn_rec.add_sample( {(double)i, _rdsom->_sim_hn_rec[i], 0.0} );
	}

	_nb_iter++;
  }
开发者ID:snowgoon88,项目名称:VisuGL,代码行数:30,代码来源:test-007-viewer.cpp

示例2: makeSurfRev

Surface makeSurfRev(const Curve &profile, unsigned steps)
{
    Surface surface;
    
    if (!checkFlat(profile))
    {
        cerr << "surfRev profile curve must be flat on xy plane." << endl;
        exit(0);
    }
    double angle = 2*PI/steps;
    Matrix3f M =  Matrix3f((float)cos(angle),0,(float)sin(angle),
			   0,1,0,
			   (float)(-sin(angle)),0,(float)cos(angle));
    M.transpose();
    Curve c = profile;
    int numPoints = c.size();
    for(unsigned s=0;s<steps;s++){
      Curve newc;
      for (unsigned i=0;i<numPoints;i++){
	CurvePoint cp  = c[i];
	surface.VV.push_back(cp.V);
	surface.VN.push_back(-cp.N);
	Vector3f newV = M*cp.V;
	Vector3f newN = M*cp.N;
	newN.normalize();
	struct CurvePoint newP = {newV, cp.T,newN,cp.B};
	newc.push_back(newP);
      }
      c = newc;
      newc.clear();
    }

    int another;
    for(unsigned s=0;s<steps;s++){
      if(s==steps-1){
        another=0;
      }else{
	another = s+1;
      }
      for(unsigned i=0;i<numPoints-1;i++){
	surface.VF.push_back(Tup3u(s*numPoints+i,another*numPoints+i,another*numPoints+i+1));
	surface.VF.push_back(Tup3u(s*numPoints+i,another*numPoints+i+1,s*numPoints+i+1));
      }
    }
    return surface;
}
开发者ID:dengxinyue0420,项目名称:6.837,代码行数:46,代码来源:surf.cpp

示例3: makeGenCyl

Surface makeGenCyl(const Curve &profile, const Curve &sweep )
{
    Surface surface;

    if (!checkFlat(profile))
    {
        cerr << "genCyl profile curve must be flat on xy plane." << endl;
        exit(0);
    }

    // TODO: Here you should build the surface.  See surf.h for details.
    Curve c = profile;
    Curve sweepL = sweep;
    unsigned step = sweep.size();
    Matrix4f transform;
    Matrix4f transinverse;
    Curve newc;
    vector<Curve> clist;
    for(unsigned i=0;i<step;i++){//sweepL.size();i++){
      CurvePoint p = sweepL[i];
      transform = getTransform(p);
      transinverse = transform.inverse();
      transinverse.transpose();
      newc.clear();
      for(unsigned j=0;j<c.size();j++){
	Vector4f tempV = transform*Vector4f(c[j].V,1);
	Vector4f tempN = transinverse*Vector4f(c[j].N,1);
	Vector3f newV = Vector3f(tempV[0],tempV[1],tempV[2]);
	Vector3f newN = Vector3f(-tempN[0],-tempN[1],-tempN[2]);
	struct CurvePoint newp = {newV,c[j].T,newN,c[j].B};
	newc.push_back(newp);
      }
      clist.push_back(newc);
    }
    for(unsigned k=0;k<clist.size()-1;k++){
      pushVV(surface,clist[k]);
      addTriangle(surface,clist[k],clist[k+1],k);
    }
    pushVV(surface,clist[clist.size()-1]);
    pushVV(surface,clist[0]);
    addTriangle(surface,clist[clist.size()-1],clist[0],clist.size()-1);
    return surface;
}
开发者ID:dengxinyue0420,项目名称:6.837,代码行数:43,代码来源:surf.cpp


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