本文整理汇总了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;
}
示例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);
}
}
}
示例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 ();
}
示例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;
}
示例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;
}
示例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, &lifier, &projector);
ft.playMovie();
return 0;
}
示例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;
}
示例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);
}
示例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++]);
//.........这里部分代码省略.........
示例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);
}
示例11: playMovie
void playMovie()
{
dvd->on();
projector->on();
amplifier->on();
dvd->play();
}
示例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 );
}
示例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();
}
示例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 );
}
示例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();
}