/// <summary> /// switches state on the basis of min max fixation times and min max saccade time /// during fixation state(slow) it wil stay in that state until maximum fixation is not reached. After the maximum fixation /// value is achieved state machine switches to saccade(fast), it will stay in that state with 50% chance on every step. /// </summary> private void SwitchState() { if (ContinousFixationTime > fixationMax) { currentState = GazeMovementState.fast; ContinousFixationTime = 0; } else if (ContinousFixationTime < fixationMin && ContinousSaccadeTime == 0) { currentState = GazeMovementState.slow; } else if (ContinousSaccadeTime > 0 && ContinousSaccadeTime < 90)// limiting time of saccade between greater than 0 ms and less than 90 ms { float r = GetRandomNumber(0, 100); if (r < 50)// 50% chance that saccade keep on happening { currentState = GazeMovementState.fast; ContinousFixationTime = 0; } else { currentState = GazeMovementState.slow; ContinousFixationTime = 0; ContinousSaccadeTime = 0; } } }
public Generator(float duration, float fixationMin, float fixationMax, float saccadeMin, float saccadeMax, float tempoaralRes, float resX, float resY, float distPartcipantScreen, float disaplaySize) { this.duration = duration; this.fixationMin = fixationMin; this.fixationMax = fixationMax; this.saccadeMin = saccadeMin; this.saccadeMax = saccadeMax; this.tempoaralRes = tempoaralRes; this.resX = resX; this.resY = resY; this.distPartcipantScreen = distPartcipantScreen; this.disaplaySize = disaplaySize; degPerPixel = RadianToDegree((float)Math.Atan2(0.5f * disaplaySize, distPartcipantScreen)) / (0.5f * resY);// degree per pixel calculation currentState = GazeMovementState.none; ContinousFixationTime = 0; ContinousSaccadeTime = 0; minDegreeForFixation = 1; maxDegreeForFixation = 5; totalDataPoints = (int)(duration * tempoaralRes); minFixationPix = ((1 / degPerPixel) * minDegreeForFixation) / totalDataPoints; // min distance that can be covered in pixels during fixation maxFixationPix = ((1 / degPerPixel) * maxDegreeForFixation) / totalDataPoints; // max distance that can be covered in pixels during fixation }