void build_three_rods() { // Ora inizializza i 3 rods (stimoli) for (int i=0; i<3; i++) { cylinder[i].setNpoints(150); cylinder[i].setRadiusAndHeight(0.1,50.0); // raggio (mm) altezza (mm) // Dispone i punti random sulla superficie cilindrica cylinder[i].compute(); stimDrawer[i].setStimulus(&cylinder[i]); // seguire questo ordine altrimenti setspheres non ha effetto se chiamata dopo StimulusDrawer::initList stimDrawer[i].setSpheres(true); stimDrawer[i].initList(&cylinder[i], glRed); } // BOX pedestal boxPedestal.setDimensions(objwidth+10.0, 55.0, depth_pedestal+5.0); boxPedestal.setNpoints(150); boxPedestal.compute(); boxPedestalDrawer.setStimulus(&boxPedestal); boxPedestalDrawer.setSpheres(true); boxPedestalDrawer.initList(&boxPedestal, glRed); // BOX stimulus boxStimulus.setDimensions(objwidth+10.0, 55.0, depth_stimulus+5.0);; boxStimulus.setNpoints(150); boxStimulus.compute(); boxStimulusDrawer.setStimulus(&boxStimulus); boxStimulusDrawer.setSpheres(true); boxStimulusDrawer.initList(&boxStimulus, glRed); }
void build_two_planes() { // BOX left boxLeft.setDimensions(40.0, 50.0, 0.1); boxLeft.setNpoints(450); boxLeft.compute(); boxLeftDrawer.setStimulus(&boxLeft); boxLeftDrawer.setSpheres(true); boxLeftDrawer.initList(&boxLeft, glRed); // BOX right boxRight.setDimensions(40.0, 50.0, 0.1);; boxRight.setNpoints(450); boxRight.compute(); boxRightDrawer.setStimulus(&boxRight); boxRightDrawer.setSpheres(true); boxRightDrawer.initList(&boxRight, glRed); // fixation rod rodMiddle.setDimensions(10.0, 5.0, 0.5);; rodMiddle.setNpoints(100); rodMiddle.compute(); rodMiddleDrawer.setStimulus(&rodMiddle); rodMiddleDrawer.setSpheres(true); rodMiddleDrawer.initList(&rodMiddle, glRed); }
void generateSphereStimulus(double radius) { int nStimulusPoints=(int)(stimulusDensity*4*M_PI*radius*radius); /* cylinder.setNpoints(nStimulusPoints); cylinder.setAperture(0,2*M_PI); cylinder.setRadiusAndHeight(radius,height); cylinder.setFluffiness(0.001); cylinder.compute(); */ sphere.setNpoints(nStimulusPoints); sphere.setRadius(radius); sphere.setFluffiness(0.001); sphere.compute(); // Update the stimulus drawer stimDrawer.setSpheres(false); stimDrawer.setStimulus(&sphere); stimDrawer.initList(&sphere,glRed,3); //stimDrawer.setStimulus(&cylinder); //stimDrawer.initList(&cylinder,glRed,3); visualStimCenter << util::str2num<double>(parameters.find("OffsetX")),0,factors.getCurrent().at("Distances"); 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)); }
void initVariables() { interoculardistance = str2num<double>(parameters.find("IOD")); // Create the factors-staircase object TrialGenerator trial.init(parameters); maxTotalTrials = trial.getRemainingTrials(); cerr << "There are " << maxTotalTrials << " total trials to do..." << endl; factors = trial.getNext(); redDotsPlane.setNpoints(300); redDotsPlane.setDimensions(50,50,0.1); redDotsPlane.compute(); //stimDrawer.drawSpecialPoints(); stimDrawer.setStimulus(&redDotsPlane); stimDrawer.setSpheres(false); stimDrawer.initList(&redDotsPlane,glRed,3); // Set the maximum x displacement of head maxXOscillation = util::str2num<double>(parameters.find("MaxXOscillation")); nOscillationsFixation = util::str2num<int>(parameters.find("NOscillationsFixation")); minOscTime = util::str2num<double>(parameters.find("MinOscillationTime")); maxOscTime = util::str2num<double>(parameters.find("MaxOscillationTime")); centerTolerance = util::str2num<double>(parameters.find("CenterTolerance")); totalTimer.start(); }
void initVariables() { double L = 2.5; double alfa = angle*M_PI/180.0; /* BoxNoiseStimulus planes[2]; double density = 0.0125; for (int i=0; i<2; i++) { int NPoints = L*L*density; planes[i].setDimensions(L,0.01,L); planes[i].setNpoints(1000); planes[i].compute(); stimDrawerPlanes[i].setSpheres(false); stimDrawerPlanes[i].setStimulus(&planes[i]); stimDrawerPlanes[i].initList(&planes[i],glRed); } */ WedgePointsStimulus wedge; wedge.setNpoints(500); wedge.setAngle(alfa); wedge.setPlanesSize(2*L, L); wedge.compute(); stimDrawer.setSpheres(false); stimDrawer.setStimulus(&wedge); stimDrawer.initList(&wedge,glRed); cerr << "angle= " << angle << endl; }
void initVariables() { interoculardistance = str2num<double>(parameters.find("IOD")); stimulusEmiCycles= atoi(parameters.find("StimulusEmiCycles").c_str()); trial.init(parameters); factors = trial.getNext(); // Initialize the factors in order to start from trial 1 if ( atoi(parameters.find("DrawOccluder").c_str()) ==1 ) { redDotsPlane.setNpoints(500); //XXX controllare densita di distribuzione dei punti redDotsPlane.setDimensions(200,200,0.1); } else { redDotsPlane.setNpoints(75); //XXX controllare densita di distribuzione dei punti redDotsPlane.setDimensions(50,50,0.1); } //redDotsPlane.setSlantTilt( factors["Slant"], (int) factors["Tilt"] ); redDotsPlane.compute(); stimDrawer.setStimulus(&redDotsPlane); stimDrawer.initList(&redDotsPlane); /** Bound check things **/ signsX.push_back(false); signsX.push_back(false); signsY.push_back(false); signsY.push_back(false); headEyeCoords.init(Vector3d(-32.5,0,0),Vector3d(32.5,0,0), Vector3d(0,0,0),Vector3d(0,10,0),Vector3d(0,0,10),interoculardistance ); eyeCalibration=headEyeCoords.getRightEye(); model.load("../data/objmodels/occluder.obj"); }
/** * @brief updateStimulus * @param CurvatureZ */ void updateStimulus(double CurvatureZ) { double radiusX = util::str2num<double>(parameters.find("RadiusX")); double noiseDensity = util::str2num<double>(parameters.find("RandomNoiseDensity")); int nRandomDots = mathcommon::getParaboloidArea(radiusX,CurvatureZ)*noiseDensity; parabolicCylinderPoints.setNpoints(nRandomDots); parabolicCylinderPoints.setCurvature(CurvatureZ); parabolicCylinderPoints.setFluffiness(0.0); parabolicCylinderPoints.compute(); stimDrawerBlack.setSpheres(false); stimDrawerRed.setSpheres(false); stimDrawerRed.setStimulus(¶bolicCylinderPoints); stimDrawerBlack.setStimulus(¶bolicCylinderPoints); float randomDotsSize = util::str2num<float>(parameters.find("RandomDotsSize")); if (parameters.find("DotsColor")=="RedAndBlack") { stimDrawerRed.initList(¶bolicCylinderPoints,glRed,randomDotsSize); parabolicCylinderPoints.compute(); stimDrawerBlack.initList(¶bolicCylinderPoints,glBlack,randomDotsSize); surface.setUniformColor(glRed); } else { stimDrawerRed.initList(¶bolicCylinderPoints,glWhite,randomDotsSize); parabolicCylinderPoints.compute(); stimDrawerBlack.initList(¶bolicCylinderPoints,glWhite,randomDotsSize); surface.setUniformColor(glWhite); } if ( parameters.find("UsePolkaDots")=="1" ) { int nSpheres = util::str2num<int>(parameters.find("TotalPolkaDots")); int dotsRadiusMin = util::str2num<int>(parameters.find("PolkaDotsRadiusMin")); int dotsRadiusMax = util::str2num<int>(parameters.find("PolkaDotsRadiusMax")); int textureResolution = util::str2num<int>(parameters.find("TextureResolution")); //surface.fillVolumeWithSpheres2(nSpheres,nSpheres,nSpheres*util::str2num<double>(parameters.find("MaxCurvatureZ")),dotsRadiusMin,dotsRadiusMax); surface.fillVolumeWithSpheres(nSpheres,dotsRadiusMin ,dotsRadiusMax); surface.initializeTexture(); surface.parabolicCylinderSurface.curvature=CurvatureZ; //surface.setUniformColor(glWhite); } }
void build_oblique_plane(double length_pedestal, double length_stimulus) { // pedestal boxOblique_pedestal.setDimensions(length_pedestal, 50.0, 0.1);; boxOblique_pedestal.setNpoints(length_pedestal*40.0*0.225); boxOblique_pedestal.compute(); boxOblique_pedestalDrawer.setStimulus(&boxOblique_pedestal); boxOblique_pedestalDrawer.setSpheres(true); boxOblique_pedestalDrawer.initList(&boxOblique_pedestal, glRed); // stimulus boxOblique_stimulus.setDimensions(length_stimulus, 50.0, 0.1);; boxOblique_stimulus.setNpoints(length_stimulus*40.0*0.225); boxOblique_stimulus.compute(); boxOblique_stimulusDrawer.setStimulus(&boxOblique_stimulus); boxOblique_stimulusDrawer.setSpheres(true); boxOblique_stimulusDrawer.initList(&boxOblique_stimulus, glRed); }
void initVariables() { interoculardistance = str2num<double>(parameters.find("IOD")); redDotsPlane.setNpoints(75); //XXX controllare densita di distribuzione dei punti redDotsPlane.setDimensions(50,50,0.1); redDotsPlane.compute(); stimDrawer.setSpheres(true); stimDrawer.setStimulus(&redDotsPlane); stimDrawer.initList(&redDotsPlane); }
void buildTrainingCylinder(double depth) { // stimolo training cylinder[3].setNpoints(250); cylinder[3].setRadiusAndHeight(depth/2,50); // raggio (mm) altezza (mm) // Dispone i punti random sulla superficie cilindrica cylinder[3].compute(); trainingstim.setStimulus(&cylinder[3]); // seguire questo ordine altrimenti setspheres non ha effetto se chiamata dopo StimulusDrawer::initList trainingstim.setSpheres(true); trainingstim.initList(&cylinder[3], glRed); }
void initVariables() { //interoculardistance = str2num<double>(parameters.find("IOD")); cylinder.setNpoints(150); cylinder.setAperture(0,2*M_PI); cylinder.setRadiusAndHeight(10,50); cylinder.setFluffiness(0.001); cylinder.compute(); // update the stimulus drawer stimDrawer.setSpheres(false); stimDrawer.setStimulus(&cylinder); stimDrawer.initList(&cylinder,glRed,3); }
void initStimulus(double height, double longAxis, double shortAxis ) { double ellipticCircumferenceApproximate = 4*3.1415*longAxis*shortAxis/(longAxis+shortAxis); // Evitiamo di calcolarci la circonferenza dell'ellisse con la mega formula tanto cambia ben poco alla fine... int nStimulusPoints=2*(int)floor(ellipticCircumferenceApproximate*height*stimulusDensity); ellipseBaseCylinder.setNpoints(nStimulusPoints); ellipseBaseCylinder.setAperture(0,2*M_PI); ellipseBaseCylinder.setAxesAndHeight(longAxis,shortAxis,height); ellipseBaseCylinder.setFluffiness(0.001); ellipseBaseCylinder.compute(); // update the stimulus drawer stimDrawer.setSpheres(false); stimDrawer.setStimulus(&ellipseBaseCylinder); stimDrawer.initList(&ellipseBaseCylinder,glRed,3); }
void initVariables() { interoculardistance = str2num<double>(parameters.find("IOD")); trial.init(parameters); factors = trial.getNext(); // Initialize the factors in order to start from trial 1 redDotsPlane.setNpoints(75); //XXX controllare densita di distribuzione dei punti redDotsPlane.setDimensions(50,50,0.1); redDotsPlane.compute(); //stimDrawer.drawSpecialPoints(); stimDrawer.setSpheres(true); stimDrawer.setStimulus(&redDotsPlane); stimDrawer.initList(&redDotsPlane); /** Bound check things **/ signs.push_back(false); signs.push_back(false); rythmMaker.start(); }
/** * @brief updateStimulus */ void updateStimulus() { double stimSize = parameters.get("StimulusSize"); double stimPeriod = parameters.get("StimulusPeriod"); double zWidth = trial.getCurrent().at("ZWidth"); int nStimulusPoints = (int)(stimSize*stimSize*parameters.get("StimulusDensity")); // Generate the plane stimulus if (parameters.find("StimulusType")=="Plane") { stimulus.setDimensions(stimSize,stimSize,0.001); stimulus.setNpoints(nStimulusPoints); stimulus.setFluffiness(0.001); stimulus.compute(); } else if (parameters.find("StimulusType")=="Sinusoid") { stimulus.setDimensions(stimSize,stimSize,0.001); stimulus.setNpoints(nStimulusPoints); stimulus.setFluffiness(0.001); for (PointsRandIterator iter = stimulus.pointsRand.begin(); iter!=stimulus.pointsRand.end();++iter) { (*iter)->x = mathcommon::unifRand(-stimSize/2,stimSize/2); (*iter)->y = mathcommon::unifRand(-stimSize/2,stimSize/2); (*iter)->z = 0.5*zWidth*sin(((*iter)->x)/stimPeriod*M_PI); } } else { throw std::runtime_error("Wrong argument! Must be Sinusoid or Plane"); } // Generate the front stimulus stimDrawer.setSpheres(false); stimDrawer.setStimulus(&stimulus); stimDrawer.initList(&stimulus,glRed,parameters.get("PointsSize")); }