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


C++ Projector类代码示例

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


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

示例1: testSarsaOnMountainCarMaxLengthTraces

void TraceTest::testSarsaOnMountainCarMaxLengthTraces()
{
  Random<double>* random = new Random<double>;
  RLProblem<double>* problem = new MountainCar<double>(random);
  Hashing<double>* hashing = new MurmurHashing<double>(random, 10000);
  Projector<double>* projector = new TileCoderHashing<double>(hashing, problem->dimension(), 10, 10,
      false);
  Trace<double>* e = new ATrace<double>(projector->dimension());
  Trace<double>* trace = new MaxLengthTrace<double>(e, 100);
  runTest(random, problem, projector, e);
  delete trace;
  delete e;

  e = new AMaxTrace<double>(projector->dimension());
  trace = new MaxLengthTrace<double>(e, 100);
  runTest(random, problem, projector, e);
  delete trace;
  delete e;

  e = new RTrace<double>(projector->dimension());
  trace = new MaxLengthTrace<double>(e, 100);
  runTest(random, problem, projector, e);
  delete trace;
  delete e;

  delete random;
  delete problem;
  delete hashing;
  delete projector;
}
开发者ID:Jimmy0319,项目名称:RLLib,代码行数:30,代码来源:TraceTest.cpp

示例2: _UpdateDirLightCamera

//----------------------------------------------------------------------------
void AmbientRegionActor::_UpdateDirLightCamera()
{
	AVector dir = AVector::AnglesToDirection(Mathf::DEG_TO_RAD*mHorAngle,
		Mathf::DEG_TO_RAD*mVerAngle);
	dir.Normalize();

	Scene *scene = DynamicCast<Scene>(GetTopestParent());
	if (scene)
	{
		EnvirParam *envirParam = scene->GetEnvirParam();

		Light *lightDir = envirParam->GetLight_Dir();
		Projector *projector = envirParam->GetLight_Dir_Projector();

		lightDir->Ambient = Float4(mAmbientColor[0], mAmbientColor[1],
			mAmbientColor[2], mIntensity);
		lightDir->Intensity = mIntensity;
		lightDir->Diffuse = Float4(mDiffuseColor[0], mDiffuseColor[1],
			mDiffuseColor[2], 1.0f);
		lightDir->Specular = Float4(mSpecularColor[0], mSpecularColor[1],
			mSpecularColor[2], mSpecularPow);

		float upDot = dir.Dot(-AVector::UNIT_Z);
		if (upDot >= 0.99f)
		{
		}
		else
		{
			AVector upTemp = AVector::UNIT_Z;
			AVector right = dir.UnitCross(upTemp);
			AVector up = right.UnitCross(dir);

			lightDir->DVector = dir;
			lightDir->UVector = up;
			lightDir->RVector = right;

			APoint camPos = mLightCameraLookPosition - dir*mLightCameraLookDistance;
			projector->SetFrame(camPos, lightDir->DVector,
				lightDir->UVector, lightDir->RVector);
		}

		if (!projector->IsPerspective())
		{
			projector->SetFrustum(0.1f, 100.0f,
				-mLightCameraExtent, mLightCameraExtent, -mLightCameraExtent,
				mLightCameraExtent);
		}
		else
		{
			projector->SetFrustum(mLightCameraExtent, 1.0f, 1.0f, 100.0f);
		}
	}
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:54,代码来源:PX2AmbientRegionActor.cpp

示例3: operator

  void operator()() {
    /* Set up MPI */
    setup ();

    /* Set up norm */
    compute_l2_norm ();
    
#if USE_PFUNC
    task root_task;
    attribute root_attribute (false /*nested*/, false /*grouped*/);
#endif

    /* Iterate until one of the stopping conditions is triggered */
    int num_selected = 0;
    while (true) {

      /* Create a projector and execute the loop for local result */
      space_type my_space = 
        partitioner_t::create (0, N, mpi_rank, mpi_size);
      Projector projector 
        (&R,&snp_map,&materializer,&filter,block_size,M,N,K);
#if USE_PFUNC
      ProjectReduceType root_project (my_space, projector, *global_taskmgr);
      pfunc::spawn (*global_taskmgr, root_task, root_attribute, root_project);
      pfunc::wait (*global_taskmgr, root_task);
#else
      projector (my_space);
#endif

      /* Reduce globally to get the result */
      edge_type selected = find_global_max (projector.get_result ());
      X.insert (selected);
      add_to_shadow (selected);
      ++num_selected;

      /* Re-estimate the coefficients given the new information */
      refit ();

      /* Compute the residual again */
      residual ();

      /* See if we have reached termination conditions */
      if (MAX_SELECT<num_selected || EPSILON>=fro_norm()) break;
    }

    /* Clean up MPI */
    cleanup ();
  }
开发者ID:pkambadu,项目名称:Covariance,代码行数:48,代码来源:mrr_modeler.hpp

示例4:

void SwingPendulumTest::testOffPACSwingPendulum2()
{
  Random<double>* random = new Random<double>;
  RLProblem<double>* problem = new SwingPendulum<double>;
  Hashing<double>* hashing = new MurmurHashing<double>(random, 1000000);
  Projector<double>* projector = new TileCoderHashing<double>(hashing, problem->dimension(), 10, 10,
      true);
  StateToStateAction<double>* toStateAction = new StateActionTilings<double>(projector,
      problem->getDiscreteActions());

  double alpha_v = 0.1 / projector->vectorNorm();
  double alpha_w = .005 / projector->vectorNorm();
  double gamma = 0.99;
  Trace<double>* critice = new AMaxTrace<double>(projector->dimension());
  Trace<double>* criticeML = new MaxLengthTrace<double>(critice, 1000);
  GTDLambda<double>* critic = new GTDLambda<double>(alpha_v, alpha_w, gamma, 0.4, criticeML);
  double alpha_u = 0.5 / projector->vectorNorm();
  PolicyDistribution<double>* target = new BoltzmannDistribution<double>(random,
      problem->getDiscreteActions(), projector->dimension());

  Trace<double>* actore = new AMaxTrace<double>(projector->dimension());
  Trace<double>* actoreML = new MaxLengthTrace<double>(actore, 1000);
  Traces<double>* actoreTraces = new Traces<double>();
  actoreTraces->push_back(actoreML);
  ActorOffPolicy<double>* actor = new ActorLambdaOffPolicy<double>(alpha_u, gamma, 0.4, target,
      actoreTraces);

  /*Policy<double>* behavior = new RandomPolicy<double>(
   &problem->getActions());*/
  Policy<double>* behavior = new BoltzmannDistribution<double>(random,
      problem->getDiscreteActions(), projector->dimension());
  OffPolicyControlLearner<double>* control = new OffPAC<double>(behavior, critic, actor,
      toStateAction, projector);

  RLAgent<double>* agent = new LearnerAgent<double>(control);
  RLRunner<double>* sim = new RLRunner<double>(agent, problem, 5000, 200, 1);
  sim->setTestEpisodesAfterEachRun(true);
  sim->run();

  delete random;
  delete problem;
  delete hashing;
  delete projector;
  delete toStateAction;
  delete critice;
  delete criticeML;
  delete critic;
  delete actore;
  delete actoreML;
  delete actoreTraces;
  delete actor;
  delete behavior;
  delete target;
  delete control;
  delete agent;
  delete sim;
}
开发者ID:csdlrl,项目名称:RLLib,代码行数:57,代码来源:SwingPendulumTest.cpp

示例5: Radius

bool
Graphic::CheckVisibility(Projector& projector)
{
    if (projector.IsVisible(     Location(), Radius()) &&
            projector.ApparentRadius(Location(), Radius()) > 1) {

        visible        = true;
    }
    else {
        visible        = false;
        screen_rect.x  = 2000;
        screen_rect.y  = 2000;
        screen_rect.w  = 0;
        screen_rect.h  = 0;
    }
    
    return visible;
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:18,代码来源:Graphic.cpp

示例6: main

int main()
{
    DVD dvd;
    Amplifier amplifier;
    Projector projector;
    // non-facade method
    // play movie
    cout<<"################# Non-facade Pattern ####################"<<endl;
    dvd.on();
    projector.on();
    amplifier.on();
    dvd.play();

    // using facade pattern
    cout<<"################# Facade Pattern ####################"<<endl;
    FacadeThreater ft(&dvd, &amplifier, &projector);
    ft.playMovie();
    return 0;
}
开发者ID:gmyofustc,项目名称:CS-notes,代码行数:19,代码来源:facade.cpp

示例7: testOnPolicyBoltzmannATraceNaturalActorCriticSwingPendulum

void SwingPendulumTest::testOnPolicyBoltzmannATraceNaturalActorCriticSwingPendulum()
{
  Random<double>* random = new Random<double>;
  RLProblem<double>* problem = new SwingPendulum<double>;
  Hashing<double>* hashing = new MurmurHashing<double>(random, 1000);
  Projector<double>* projector = new TileCoderHashing<double>(hashing, problem->dimension(), 10, 10,
      true);
  StateToStateAction<double>* toStateAction = new StateActionTilings<double>(projector,
      problem->getDiscreteActions());

  double alpha_v = 0.1 / projector->vectorNorm();
  double alpha_u = 0.001 / projector->vectorNorm();
  double lambda = 0.4;
  double gamma = 0.99;

  Trace<double>* critice = new ATrace<double>(projector->dimension());
  TDLambda<double>* critic = new TDLambda<double>(alpha_v, gamma, lambda, critice);

  PolicyDistribution<double>* acting = new BoltzmannDistribution<double>(random,
      problem->getDiscreteActions(), projector->dimension());

  ActorOnPolicy<double>* actor = new ActorNatural<double>(alpha_u, alpha_v, acting);
  OnPolicyControlLearner<double>* control = new ActorCritic<double>(critic, actor, projector,
      toStateAction);
  RLAgent<double>* agent = new LearnerAgent<double>(control);
  RLRunner<double>* sim = new RLRunner<double>(agent, problem, 5000, 50, 10);
  sim->setTestEpisodesAfterEachRun(true);
  sim->run();
  sim->computeValueFunction();

  delete random;
  delete problem;
  delete hashing;
  delete projector;
  delete toStateAction;
  delete critice;
  delete critic;
  delete actor;
  delete acting;
  delete control;
  delete agent;
  delete sim;
}
开发者ID:csdlrl,项目名称:RLLib,代码行数:43,代码来源:SwingPendulumTest.cpp

示例8: setup

    void PeripheralSetup::setup(Projector& _proj)
    {
      QMatrix4x4 _matrix;

      qreal _theta = yaw().radians();
      qreal _ct = -cos(_theta), _st = -sin(_theta);
      QVector2D _shiftVec = QVector2D(-_st,_ct) * shift_;
      QVector2D _p = _shiftVec +  distanceCenter_ * QVector2D(_ct,_st);
      QVector3D _pos = QVector3D(_p.x(),_p.y(),towerHeight_);
      _matrix.translate(_pos);

      _matrix.rotate(yaw().degrees() + deltaYaw_.degrees(),QVector3D(0.0,0.0,1.0));
      _matrix.rotate(-pitch().degrees(),QVector3D(0.0,1.0,0.0));
      _matrix.rotate(roll().degrees(),QVector3D(1.0,0.0,0.0));
      _proj.setMatrix(_matrix);
    }
开发者ID:emervark,项目名称:omnidome,代码行数:16,代码来源:PeripheralSetup.cpp

示例9: main

//program main entry point
int main(int argc, char **argv)
{
  Projector projector;
  Projection * outproj = NULL; //output projection
  CLineProgress progress; //output progress
  MathLib::Point newscale;
  int pmeshname, pmeshsize;
  int myopt;
  clock_t start = 0, finish = 0;
  std::string logname, filename(std::string(" ")), 
    parameterfile(std::string(" "));
  std::string outfile;
  bool timefile = false;
  bool samescale = false;
  std::ofstream out;

  try
  {
    pmeshname = 0;
    pmeshsize = 4;
    newscale.x = 0;
    newscale.y = 0;
    //parse the arguments
    while (( myopt = getopt(argc, argv, "Ss:l:n:p:?")) != -1)
      switch(myopt)
      {
      case 'S':
        {
          samescale = true;
        }
        break;
      case 's':
        {
          if (optarg)
          {
            newscale.x = atof(optarg);
            newscale.y = newscale.x;
          }
          
        }
        break;
      case 'l':
        {
          if (optarg)
          {
            timefile = true;
            logname = optarg;
          }
        }
		break;
      case 'n':
        {
          if (optarg)
          {
            pmeshsize = atoi(optarg);
                  
          }
		  
        }
        break;
      case 'p':
        {
          if (optarg)
          {
            pmeshname = atoi(optarg);
                  
          }
          break;
        }
      case '?':
      default: // help
        {
          std::cout << "Usage: " << argv[0] << " [options] "
                    << "InputFile InputProjectionFile [outputfile]"
                    << std::endl;
          std::cout << "where options are: " << std::endl;
          std::cout << "   -p pmesh number 6=LeastSqrs 8=Bilinear "
                    << "9=bicubic" << std::endl;
          std::cout << "   -n pmeshsize" << std::endl;
          std::cout << "   -l logfile for timings " << std::endl;
          std::cout << "   -s number where number is the output scale" 
                    << std::endl;
          std::cout << "   -S forces output scale same length as input scale"
                    << std::endl;
          std::cout << "   -? this help screen" << std::endl;
          return 0;
        }
      }
    
    if (optind > argc-2 || argv[optind+1] == NULL)
    {
      std::cout << "You must specify a input file and a input projection file"
                << std::endl
                << "See -h for help" << std::endl;
      return 0;
    }
    else
    {
      filename = std::string(argv[optind++]);
//.........这里部分代码省略.........
开发者ID:briangmaddox,项目名称:USGS-Projector,代码行数:101,代码来源:Main.cpp

示例10: watchMovie

 void watchMovie(std::string movie) {
     std::cout << "Get ready to watch a movie..." << std::endl;
     _popper->on();
     _popper->pop();
     _lights->dim(10);
     _screen->down();
     _projector->on();
     _projector->wideScreenMode();
     _amp->on();
     _amp->setDvd(_dvd);
     _amp->setSurroundSound();
     _amp->setVolume(5);
     _dvd->on();
     _dvd->play(movie);
 }
开发者ID:greenpea1121,项目名称:DesignPatternExample,代码行数:15,代码来源:HomeTheaterFacade.hpp

示例11: playMovie

 void playMovie()
 {
     dvd->on();
     projector->on();
     amplifier->on();
     dvd->play();
 }
开发者ID:gmyofustc,项目名称:CS-notes,代码行数:7,代码来源:facade.cpp

示例12: watchMovie

 void watchMovie( std::string movie )
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::watchMovie"));
   std::cout << "Get ready to watch a movie..." << std::endl;
   _popper->on();
   _popper->pop();
   _lights->dim( 10 );
   _screen->down();
   _projector->on();
   _projector->wideScreenMode();
   _amp->on();
   _amp->setDvd( _dvd );
   _amp->setSurroundSound();
   _amp->setVolume( 5 );
   _dvd->on();
   _dvd->play( movie );
 }
开发者ID:aeuveritas,项目名称:hfdpcpp_s,代码行数:17,代码来源:HomeTheaterFacade.hpp

示例13: endMovie

 void endMovie() {
     std::cout << "Shutting movie theater down..." << std::endl;
     _popper->off();
     _lights->on();
     _screen->up();
     _projector->off();
     _amp->off();
     _dvd->stop();
     _dvd->eject();
     _dvd->off();
 }
开发者ID:greenpea1121,项目名称:DesignPatternExample,代码行数:11,代码来源:HomeTheaterFacade.hpp

示例14: map

 uchar* map(float dstx, float dsty)
 {
   float sx = dstx*e1x + dsty*e1y;
   float sy = dstx*e2x + dsty*e2y;
   float dy = floor( sy / h + 0.5 );
   sy -= h*dy;
   sx += (L-offset)*dy;
   sx = sx / h * aspect * 2.0;
   sy = sy / h * aspect * 2.0;
   sx -= floor( sx/2.0 + 0.5 )*2.0;
   return child->map( sx, sy );
 }
开发者ID:vitroid,项目名称:Panojector,代码行数:12,代码来源:tile2.cpp

示例15: endMovie

 void endMovie()
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::endMovie"));
   std::cout << "Shutting movie theater down..." << std::endl;
   _popper->off();
   _lights->on();
   _screen->up();
   _projector->off();
   _amp->off();
   _dvd->stop();
   _dvd->eject();
   _dvd->off();
 }
开发者ID:aeuveritas,项目名称:hfdpcpp_s,代码行数:13,代码来源:HomeTheaterFacade.hpp


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