Пример #1
0
        private void tracker_GazeDataReceived(IEyeTrackerDriver sender, GazeData gaze)
        {
            double?distance = gaze.GetEyeDistance();

            double?relativeEyeDistance = gaze.GetRelativeEyeDistance();
            var    recommendation      = GetRecommendation(relativeEyeDistance);

            // Point (0,0,0) of the TrackBox Coordinate System is in the top right corner nearest to the eye tracker from the user's
            // point of view (see Figure 3, Tobii Analytics SDK Developers Guide, p. 15), not the top left corner like the screen is,
            // so we swap the X coordinate. Y coordinate is still in the right direction.
            var leftEyePosition  = new Point2(1 - gaze.LeftEye.EyePosition3DRelative.X, gaze.LeftEye.EyePosition3DRelative.Y);
            var rightEyePosition = new Point2(1 - gaze.RightEye.EyePosition3DRelative.X, gaze.RightEye.EyePosition3DRelative.Y);

            PositionChanged?.Invoke(this, new EyesPosition(leftEyePosition, gaze.Validity.HasLeftEye(),
                                                           rightEyePosition, gaze.Validity.HasRightEye(),
                                                           distance, relativeEyeDistance, recommendation));
        }