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


C++ BalanceFactor::next方法代码示例

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


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

示例1: advanceTrial

void advanceTrial()
{
	double timeElapsed = globalTimer.getElapsedTimeInMilliSec();

	responseFile.precision(3); // max three decimal positions
	responseFile << fixed << 
			parameters.find("SubjectName") << "\t" <<
			trialNumber << "\t" <<
			repetitions << "\t" <<
			starting_theta << "\t" <<
			final_theta << "\t" <<
			trial.getCurrent()["Tilt_sign"] << "\t" <<
			timeElapsed << "\t" << 
			endl;
 
	trialNumber++;

	if(trial.hasNext())
	{
		trial.next();
		initTrial();
	} else if (repetitions < max_repetitions)
	{	
		repetitions++;
		initVariables();
		trial.next();
		initTrial();
	} else
	{
		responseFile.close();
		expFinished = true;
		beepOk(4);
	}
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: advanceTrial

void advanceTrial()
{
	beepOk(0);
	double timeElapsed = timer.getElapsedTimeInMilliSec();
	responseFile.precision(3); // max three decimal positions
	responseFile << fixed << 
			parameters.find("SubjectName") << "\t" <<
			interoculardistance << "\t" <<
			trialNumber << "\t" <<
			trial.getCurrent()["AbsDepth"] << "\t" << 
			objwidth << "\t" << 
			adjDz << "\t" << 
			timeElapsed
			<< endl;

	trialNumber++;
	if(trial.hasNext())
	{
		trial.next();
		initTrial();
	} else
	{	
		isStimulusDrawn=false;
		drawGLScene();
		responseFile.close();
		expFinished = true;
	}

}
开发者ID:guendas,项目名称:cncsvision,代码行数:29,代码来源:spring15-armlength-adj.cpp

示例3: initVariables

void initVariables()
{
    cam.setOrthoGraphicProjection((bool)str2num<int>(parameters.find("OrthographicMode")));
    drawInfo = (bool)util::str2num<int>(parameters.find("DrawInfo"));
    //cam.setOrthoGraphicProjection(orthoMode);
    cerr << "COMPUTED IOD=" << interoculardistance  << endl;
    trial.init(parameters);

    stimulusTime=util::str2num<double>(parameters.find("StimulusTime"));
    trialTimer.start();

    trial.next();
    interoculardistance = str2num<double>(parameters.find("IOD"))*trial.getCurrent().at("IODFactor");

    int textureResolution = util::str2num<int>(parameters.find("TextureResolution"));
    int maxTextureResolutionZ = (int) std::ceil(textureResolution*util::str2num<double>(parameters.find("MaxCurvatureZ")));
    // allocate the texture memory
    if (parameters.find("UsePolkaDots")=="1")
    {
        surface.resize(textureResolution,textureResolution, maxTextureResolutionZ);
        surface.initializeSurfaceShaders(VolumetricSurfaceIntersection::SurfaceParabolicCylinder);
    }
    updateStimulus(trial.getCurrent().at("CurvatureZ"));
    CurvatureZ=0.0;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例4: advanceTrial

void advanceTrial()
{
	double timeElapsed = timer.getElapsedTimeInMilliSec();
	responseFile.precision(3);
    responseFile << 
					parameters.find("SubjectName") << "\t" <<
					//interoculardistance << "\t" <<
					trialNumber << "\t" <<
					stimPosn << "\t" <<
					"-420" << "\t" <<//trial.getCurrent()["AbsDepth"] <<"\t" <<
                    "50" << "\t" <<//trial.getCurrent()["ObjHeight"] <<"\t" <<
                    timer.getElapsedTimeInMilliSec() << "\t" <<
					//trial.getCurrent()["HapticFB"] << "\t" <<
					//randCond << "\t" <<
					//randIncrement << "\t" <<
					stimCond << "\t" <<
					pulsingColors << "\t" <<
					endl;
	
	trialFile.close();

	trialNumber++;

	if( !trial.isEmpty() )
	{
		trial.next();
		initTrial();
	}
	else
	{
		exit(0);
	}

}
开发者ID:guendas,项目名称:cncsvision,代码行数:34,代码来源:spring14-evan-haptic-spatial.cpp

示例5: main

int main(int argc, char*argv[])
{
#ifdef TEST
	mathcommon::randomizeStart();

	// initializing experiment's parameters
	initRendering();
	initStreams();
	trial.next();
	initTrial();

	return 0;
#else
	mathcommon::randomizeStart();

	// initializes optotrak and velmex motors
	initOptotrak();

	initMotors();

	// initializing glut
	glutInit(&argc, argv);
	#ifndef SIMULATION
		glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STEREO);
		glutGameModeString("1024x768:[email protected]");
		glutEnterGameMode();
		glutFullScreen();
	#else
		glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
		glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT);
		glutCreateWindow("Simulation test");
	#endif

	// initializing experiment's parameters
	initRendering();
	initStreams();

	// glut callback
	glutDisplayFunc(drawGLScene);
	glutKeyboardFunc(handleKeypress);
	glutMouseFunc(mouseFunc);
	glutReshapeFunc(handleResize);
	glutIdleFunc(idle);
	glutTimerFunc(TIMER_MS, update, 0);
	glutSetCursor(GLUT_CURSOR_NONE);

	boost::thread initVariablesThread(&initVariables);

	// Application main loop
	glutMainLoop();

	cleanup();

	return 0;
#endif
}
开发者ID:guendas,项目名称:cncsvision,代码行数:56,代码来源:testFall14-ernst_banks_test_1.2.cpp

示例6: initializeExperiment

/**
 * @brief initializeExperiment
 */
void initializeExperiment()
{
    // MUST BE CALLED WITHIN A VALID OPENGL CONTEXT
    //Screen screen(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH, alignmentX, alignmentY, focalDistance );
	screen.init(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH, alignmentX, alignmentY, focalDistance );
	screen.setOffset(alignmentX,alignmentY);
    screen.setFocalDistance(focalDistance);
    cam.init(screen);

    // Initialize all the streams for file output eccetera
	parameters.loadParameterFile("C:/cncsvisiondata/parametersFiles/Fulvio/expMicroHeadMovements/parametersExpMicroHeadMovementsActive.txt");
	// Initialize focal distance and interocular distance from parameter file
    focalDistance = parameters.get("FocalDistance");
    interocularDistance = parameters.get("IOD");
    infoDraw = (int)parameters.get("DrawInfo");
	useCircularOcclusor = (int)parameters.get("UseCircularOcclusor");
    // Initialize trials balance factors
    trial.init(parameters);
	trial.next();
    // Base directory, full path
    string baseDir = parameters.find("BaseDir");
    // Subject name
    string subjectName = parameters.find("SubjectName");
    // Principal streams file

	string markersFileName = baseDir + "markersFile_MicroHeadMovementsActive_" + subjectName  + ".txt";
    string outputFileName  = baseDir + "responseFile_MicroHeadMovementsActive_" + subjectName +".txt";
    string timingFileName  = baseDir + "timingFile_MicroHeadMovementsActive_" + subjectName   + ".txt";
    // Check for output file existence
    if ( !util::fileExists((outputFileName)) )
        responseFile.open(outputFileName.c_str());
    cerr << "File " << outputFileName << " loaded successfully" << endl;

	// Check for output markers file existence
    if ( !util::fileExists((markersFileName)) )
        markersFile.open(markersFileName.c_str());
   cerr << "File " << markersFileName << " loaded successfully" << endl;

	// Check for output timing file existence
    if ( !util::fileExists((timingFileName)) )
        timingFile.open(( timingFileName ).c_str());
    cerr << "File " << timingFileName << " opened successfully" << endl;

	// Write the response file header
    responseFile << "# SubjectName\tTrialNumber\tFocalDistance\tKeyPressed\tResponseTime\tfZWidth\tfSlant\tfTilt\tfStimAnchored" << endl;

  // Finished loading parameter files

    // Update the stimulus
    updateStimulus();

    trialTimer.start();
    globalTimer.start();
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例7: advanceTrial

/**
 * @brief advanceTrial: This function to the next trial
 */
void advanceTrial()
{
    fingersTimer.start(); // Here we change trial mode

    if (trialMode == HANDONSTARTMODE )
    {
        // Wait to show the stimulus that the fingers points are projected in the screen
        trialMode = STIMULUSMODE;
    }
    else // trialMode == STIMULUSMODE
    {
		trialMode = HANDONSTARTMODE;
		paintGL();
		beepTrial();
		double oldDistance = factors.getCurrent().at("Distances");
        // Reinsert the trial if too much occluded frames
		double maxInvisibleFramesPercent = util::str2num<double>(parameters.find("MaxPercentOccludedFrames"))/100.0;
		if ( (invisibleIndexFrames / ((double)drawingTrialFrame) > maxInvisibleFramesPercent ) ||
			(invisibleThumbFrames / ((double)drawingTrialFrame) > maxInvisibleFramesPercent )||
			(invisibleWristFrames / ((double)drawingTrialFrame) > maxInvisibleFramesPercent ) )
		{
			map<string,double> currentFactorsList = factors.getCurrent();
            beepBad();
            cerr << "Reinserted current trial (InvIndex,InvThumb,drawingTrialFrame,totTrialFrame)" << invisibleIndexFrames << " " << invisibleThumbFrames << " " << drawingTrialFrame << " " << trialFrame << endl;
            factors.reinsert(currentFactorsList);
		}
		if (factors.isEmpty())
        {
            beepLong();
            beepLong();
            beepLong();
            plato_stop();
			exit(0);
        }
        invisibleIndexFrames = invisibleThumbFrames = invisibleWristFrames = trialFrame = drawingTrialFrame = 0;
        totalTrialNumber++;
		factors.next();
		
		if (oldDistance == factors.getCurrent().at("Distances"))
		{
			Timer sleepTimer; sleepTimer.sleep(1000);
		}
		
		double marker5z = markers.at(5).p.z();
		generateSphereStimulus( factors.getCurrent().at("StimulusRadius") );
        initProjectionScreen(factors.getCurrent().at("Distances"));
        moveStimulusObject(visualStimCenter,3500);
    }
}
开发者ID:guendas,项目名称:cncsvision,代码行数:52,代码来源:expChiaraVirtual_Pilot.cpp

示例8: initTrial

void initTrial()
{
	//factors = trial.getNext();
	trial.next();
	isStimulusDrawn=false;
	drawGLScene();
	initProjectionScreen(trial.getCurrent()["AbsDepth"]);
	zedge = 0;
	frame = 0;
	timeStim=0;
	judgment=0;
	occludedFrames = 0;
	frontRodShown=false;

	if(trial.getCurrent()["AbsDepth"]==-300)
	{
		if(trial.getCurrent()["RelDepthObj"]==30)
		{
			estdepth = str2num<double>(subjParams.find("[email protected]"));
			estsd = str2num<double>(subjParams.find("[email protected]"));
		} else if(trial.getCurrent()["RelDepthObj"]==50)
		{
			estdepth = str2num<double>(subjParams.find("[email protected]"));
			estsd = str2num<double>(subjParams.find("[email protected]"));
		}
	} else if(trial.getCurrent()["AbsDepth"]==-450)
	{
		if(trial.getCurrent()["RelDepthObj"]==30)
		{
			estdepth = str2num<double>(subjParams.find("[email protected]"));
			estsd = str2num<double>(subjParams.find("[email protected]"));
		} 
		else if(trial.getCurrent()["RelDepthObj"]==50)
		{
			estdepth = str2num<double>(subjParams.find("[email protected]"));
			estsd = str2num<double>(subjParams.find("[email protected]"));
		}
	}

	jitter = unifRand(str2num<double>(parameters.find("VirtualObjRelDepthLowBound")),
		str2num<double>(parameters.find("VirtualObjRelDepthUpBound")));
	beepOk(0);
	timer.start();
	isStimulusDrawn=true;
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例9: initializeExperiment

/**
 * @brief initializeExperiment
 */
void initializeExperiment()
{
    initStreams();
	factors.init(parameters);
    factors.next();
    generateSphereStimulus(factors.getCurrent().at("StimulusRadius") );
    initProjectionScreen(factors.getCurrent().at("Distances"));

	vector<double> distances = util::str2num<double>(parameters.find("fDistances")," ");
	maxCoveredDistance = max(distances.begin(),distances.end()) - min(distances.begin(),distances.end());

	selectedFinger = util::str2num<int>(parameters.find("SelectedFinger"));
	// For the rod initialization
	thetaRod = M_PI/180.0*parameters.get("RodLatitude");
	phiRod = M_PI/180.0*parameters.get("RodLongitude");
	r = parameters.get("RodRadius");
	rodStart = visualStimCenter + r*Vector3d(sin(thetaRod)*cos(phiRod),cos(thetaRod),sin(thetaRod)*sin(phiRod));
	rodEnd= visualStimCenter - r*Vector3d(sin(thetaRod)*cos(phiRod),cos(thetaRod),sin(thetaRod)*sin(phiRod));
}
开发者ID:guendas,项目名称:cncsvision,代码行数:22,代码来源:expChiaraVirtual_Pilot.cpp

示例10: advanceTrial

void advanceTrial()
{
	//summaryFile.precision(3);
	summaryFile << parameters.find("SubjectName") << "\t" <<
			interoculardistance << "\t" <<
			trialNumber << "\t" <<
			absDepth <<"\t" <<
			stimulus_height[1] << "\t" <<
			trial.getCurrent()["ConstantStimuli"] << "\t" <<
			stimulus_height[first_interval] << "\t" <<	
			stimulus_height[second_interval] << "\t" <<	
			stimulus_noise << "\t" <<	
			responsekey << "\t" <<	
			testJND <<
			endl;

	trialNumber++;
	trial.next();
	initTrial();
}
开发者ID:guendas,项目名称:cncsvision,代码行数:20,代码来源:testFall14-ernst_banks_test_1.2.cpp

示例11: handleKeypress

// Funzione di callback per gestire pressioni dei tasti
void handleKeypress(unsigned char key, int x, int y)
{   switch (key)
    {   //Quit program
	case 'x':
		// Facendo cosi si cancella lo stimolo durante il movimento (SINCRONO) del monitor.
		// Si imposta il isStimulusDrawn a FALSE e si riaggiorna la schermata con una drawGLScene()
		// infine si muove il monitor, la chiamata blocca il programma per x secondi, si 
		// simula lo spostamento dello schermo di proiezione ed infine si reimposta isStimulusDrawn a TRUE
		// cosi' la prossima chiamata di drawStimulus() lo disegna correttamente a schermo. Provare per credere...
		//factors = trial.getNext();
		trial.next();
		isStimulusDrawn=false;
		drawGLScene();
		initProjectionScreen(trial.getCurrent()["AbsDepth"]);
		isStimulusDrawn=true;
		break;
	case 'i':
		visibleInfo=!visibleInfo;
		break;
	case 'm':
		interoculardistance += 0.5;
	break;
	case 'n':
		interoculardistance -= 0.5;
	break;
	case '+':
	{
		// Il trucco per avanzare alla modalita' trial successiva: incrementi di uno e poi tieni il resto della 
		// divisione per due, in questo caso ad esempio sara' sempre:
		// 0,1,0,1,0,1
		// se metti il resto della divisione per 3 invece la variabile trialMode sar'
		// 0,1,2,0,1,2
		// ogni ciclo della variabile trialMode normalmente e' un trial (1)
		// puoi anche definire una funzione void advanceTrial() che si occupa di andare al trial successivo,
		// deve contenere una chiamata alla BalanceFactor::getNext() cosi' passi alla nuova lista di fattori
		// Ad esempio
		 trialMode++;
		 trialMode=trialMode%3;
	}
	break;
	case 't':
	{
		if (trial.isEmpty())
			exit(0);
		trial.next();

		break;
	}
	case 'Q':
	case 'q':
    case 27:	//corrisponde al tasto ESC
    {   
		// Ricorda quando chiami una funzione exit() di chiamare prima cleanup cosi
		// spegni l'Optotrak ed i markers (altrimenti loro restano accesi e li rovini) 
		cleanup();
        exit(0);
    }
    break;
    case ' ':
    {
        // Here we record the head shape - coordinates of eyes and markers, but centered in (0,0,0)
        if ( headCalibrationDone==0 && allVisiblePatch )
        {
            headEyeCoords.init(markers[1].p-Vector3d(230,0,0),markers[1].p, markers[5].p,markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=1;
			beepOk(0);
            break;
        }
        // Second calibration, you must look a fixed fixation point
        if ( headCalibrationDone==1 && allVisiblePatch )
        {
            headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[5].p, markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=2;
            break;
        }
    }
    break;
    // Enter key: press to make the final calibration
    case 13:
    {
        if ( headCalibrationDone == 2 && allVisiblePatch )
        {
            headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[1].p, markers[2].p,markers[3].p,interoculardistance );
            headCalibrationDone=3;
			visibleInfo=false;
        }
    }
    break;
      case '5':
      {  
		  if(dz/2>10)
			zedge -= .25;
		  else
			  zedge = zedge;
	  }
      break;
      case '8':
      {  
		 zedge += .25;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例12: handleKeypress


//.........这里部分代码省略.........
    break;
	case 'd':
		{
		fingersShown = !fingersShown;
		}
	break;
    case ' ':
    {
        // Here we record the head shape - coordinates of eyes and markers, but centered in (0,0,0)
        if ( headCalibrationDone==0 && allVisiblePatch )
        {
            headEyeCoords.init(markers[1].p-Vector3d(230,0,0),markers[1].p, markers[5].p,markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=1;
			beepOk(0);
            break;
        }
        // Second calibration, you must look a fixed fixation point
        if ( headCalibrationDone==1 && allVisiblePatch )
        {
            headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[5].p, markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=2;
            break;
        }
    }
    break;
	case 'f':
	case 'F':
		{
		// Here we record the finger tip physical markers
		if ( allVisiblePlatform && (fingerCalibrationDone==0) )
			{
			//platformFingers=markers[1].p;
			platformIndex=markers[1].p;
			platformThumb=markers[2].p;
			//centercal = markers[4].p;
			fingerCalibrationDone=1;
			beepOk(0);
			break;
			}
		if ( (fingerCalibrationDone==1) && allVisibleFingers )
			{
			indexCoords.init(platformIndex, markers.at(13).p, markers.at(14).p, markers.at(16).p );
			thumbCoords.init(platformThumb, markers.at(15).p, markers.at(17).p, markers.at(18).p );
			fingerCalibrationDone=2;
			beepOk(0);
			break;
			}
		if ( fingerCalibrationDone==2  && allVisibleFingers )
			{
			beepOk(0);
			fingerCalibrationDone=3;
			visibleInfo=!visibleInfo;
			trial.next();
			initTrial();
			break;
			}
		}
		break;
    // Enter key: press to make the final calibration
    case 13:
    {
        if ( headCalibrationDone == 2 && allVisiblePatch )
        {
            headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[5].p, markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=3;
			visibleInfo=false;
        }
    }
    break;
      case '5':
      {  
		  theta += 1;
	  }
      break;
      case '8':
      {  
		theta -= 1;
      }
      break;
      case 's':
      {  
		  advanceTrial();
	  }
      break;
	  case '0':
	  {
		 training=!training;
	  }
	  break;
	  case 'c':
	  {
		 pulsingColors=!pulsingColors;
	  }
	  break;
	  case 'l': //L
	  {
		 //hapticLarger=!hapticLarger;
	  }
	}
}
开发者ID:guendas,项目名称:cncsvision,代码行数:101,代码来源:spring14-evan-haptic-spatial.cpp

示例13: handleKeypress

// Funzione di callback per gestire pressioni dei tasti
void handleKeypress(unsigned char key, int x, int y)
{   
	switch (key)
	{   
		case 'x': // test for final screen
			expFinished=true;
			break;

		case 'i': // show info
			visibleInfo=!visibleInfo;
			break;

		case 'm': // increase IOD
			interoculardistance += 0.5;
			break;

		case 'n': // decrease IOD
			interoculardistance -= 0.5;
			break;

		case '8': // increase object's depth
		{
			adjDz += .25;
			offsetZ += .25;
		} break;

		case '5': // decrease object's depth
		{
			adjDz -= .25;
			offsetZ -= .25;
		} break;

		case '0': // go to the next trial
		{
			if(expStarted && offsetZ != 0.0)
				advanceTrial();
		} break;

		case 27: // press escape to quit
		{   
			cleanup(); // clean the optotrak buffer
			exit(0);
		} break;

		case 13: // press enter to start
		{   
			if(!expStarted)
			{
				// turn off info
				visibleInfo = false;
	/*
				// check where the object is
				object_reset_position = markers[3].p.transpose();
				// calculate where the object has to go
				Vector3d object_position(0.0,object_reset_position.y(),-330.0);
				// move the object to position from where it is
				moveObjectAbsolute(object_position, object_reset_position, 5000);
	*/
				// start the experiment
				expStarted = true;
				trial.next();
				initTrial();
			}
		} break;
	}
}
开发者ID:guendas,项目名称:cncsvision,代码行数:67,代码来源:spring15-armlength-adj.cpp


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