public SampleData(EyeSample leftEye,EyeSample rightEye,double timeStamp) { averagedEye = leftEye + rightEye; this.leftEye = leftEye; this.rightEye = rightEye; this.timeStamp = timeStamp; }
public SampleData() { averagedEye = new EyeSample(Vector2.zero,Vector3.zero,0.0); leftEye = new EyeSample(Vector2.zero, Vector3.zero, 0.0); rightEye = new EyeSample(Vector2.zero, Vector3.zero, 0.0); timeStamp = 0; }
/// <summary> /// Write the Data into the gazeModel /// </summary> /// <param name="leftEye"></param> /// <param name="rightEye"></param> /// <returns></returns> public bool WriteEyeSamplesInGazeModel(SDKSampleStruct dataSample) { try { Vector2 leftEyeGaze = new Vector2((float)dataSample.leftEye.gazeX, (float)dataSample.leftEye.gazeY); Vector3 leftEyePosition = new Vector3((float)dataSample.leftEye.eyePositionX, (float)dataSample.leftEye.eyePositionY, (float)dataSample.leftEye.eyePositionZ); Vector2 rightEyeGaze = new Vector2((float)dataSample.rightEye.gazeX, (float)dataSample.rightEye.gazeY); Vector3 rightEyePosition = new Vector3((float)dataSample.rightEye.eyePositionX, (float)dataSample.rightEye.eyePositionY, (float)dataSample.rightEye.eyePositionZ); #if UNITY_EDITOR //Remove the Offset from the Topbar of the Editor leftEyeGaze.y -= 110f; rightEyeGaze.y -= 110f; #endif EyeSample leftEye = new EyeSample(leftEyeGaze, leftEyePosition, dataSample.leftEye.diam); EyeSample rightEye = new EyeSample(rightEyeGaze, rightEyePosition, dataSample.rightEye.diam); this.dataSample = new SampleData(leftEye, rightEye, dataSample.timestamp); return true; } catch (System.Exception e) { UnityEngine.Debug.LogException(e); return false; } }