public void OnGazeData(Tobii.Gaze.Core.GazeData gd)
        {
            // Add data to history
            _dataHistory.Enqueue(gd);

            // Remove history item if necessary
            while (_dataHistory.Count > HistorySize)
            {
                _dataHistory.Dequeue();
            }

            _eyesValidity = gd.TrackingStatus;

            _leftEye  = gd.Left.GazePointOnDisplayNormalized;
            _rightEye = gd.Right.GazePointOnDisplayNormalized;

            Invalidate();
        }
Пример #2
0
        //public void OnGazeData(TETCSharpClient.Data.GazeData gd)
        //{
        //    //// Add data to history
        //    //_dataHistory.Enqueue(gd);

        //    //// Remove history item if necessary
        //    //while (_dataHistory.Count > HistorySize)
        //    //{
        //    //    _dataHistory.Dequeue();
        //    //}

        //    ////_leftValidity = gd.LeftValidity;
        //    ////_rightValidity = gd.RightValidity;
        //    _eyesValidity = tobiiValidity2EyeTribeValidity(gd);

        //    //_leftEye = gd.LeftEyePosition3DRelative;
        //    //_rightEye = gd.RightEyePosition3DRelative;

        //    _leftEye = new Point3D(1-gd.LeftEye.PupilCenterCoordinates.X, gd.LeftEye.PupilCenterCoordinates.Y, 0);// gd.Left.EyePositionInTrackBoxNormalized;
        //    _rightEye = new Point3D(1-gd.RightEye.PupilCenterCoordinates.X, gd.RightEye.PupilCenterCoordinates.Y, 0);

        //    Invalidate();
        //}

        //private TrackingStatus tobiiValidity2EyeTribeValidity(TETCSharpClient.Data.GazeData gd)
        //{
        //    if (
        //        ((gd.State & TETCSharpClient.Data.GazeData.STATE_TRACKING_GAZE) != 0) ||
        //        ((gd.State & TETCSharpClient.Data.GazeData.STATE_TRACKING_EYES) != 0)
        //        )
        //        return TrackingStatus.BothEyesTracked;
        //    else
        //        return TrackingStatus.BothEyesTracked; //TrackingStatus.NoEyesTracked;
        //}

        public void OnGazeData(Tobii.Gaze.Core.GazeData gd)
        {
            // Add data to history
            _dataHistory.Enqueue(gd);

            // Remove history item if necessary
            while (_dataHistory.Count > HistorySize)
            {
                _dataHistory.Dequeue();
            }

            //_leftValidity = gd.LeftValidity;
            //_rightValidity = gd.RightValidity;
            _eyesValidity = gd.TrackingStatus;

            //_leftEye = gd.LeftEyePosition3DRelative;
            //_rightEye = gd.RightEyePosition3DRelative;
            _leftEye  = gd.Left.EyePositionInTrackBoxNormalized;
            _rightEye = gd.Right.EyePositionInTrackBoxNormalized;

            Invalidate();
        }
        public static PointD WeighGaze(Tobii.Gaze.Core.GazeData GazeData2Weigh)
        {
            PointD GazeWeighed = new PointD();
            double leftWeigh;
            double rightWeigh;
            double totalWeigh;

            switch (GazeData2Weigh.TrackingStatus)
            {
            //los dos ojos
            case TrackingStatus.BothEyesTracked:
                leftWeigh  = 1;
                rightWeigh = 1;
                totalWeigh = 0.5;
                break;

            //left solo
            case TrackingStatus.OneEyeTrackedProbablyLeft:
                leftWeigh  = 1;
                rightWeigh = 0;
                totalWeigh = 1;
                break;

            case TrackingStatus.OnlyLeftEyeTracked:
                leftWeigh  = 1;
                rightWeigh = 0;
                totalWeigh = 1;
                break;

            //rigth solo
            case TrackingStatus.OneEyeTrackedProbablyRight:
                leftWeigh  = 0;
                rightWeigh = 1;
                totalWeigh = 1;
                break;

            case TrackingStatus.OnlyRightEyeTracked:
                leftWeigh  = 0;
                rightWeigh = 1;
                totalWeigh = 1;
                break;

            //peores casos
            case TrackingStatus.NoEyesTracked:
                leftWeigh  = Double.NaN;
                rightWeigh = Double.NaN;
                totalWeigh = Double.NaN;
                break;

            case TrackingStatus.OneEyeTrackedUnknownWhich:
                leftWeigh  = Double.NaN;
                rightWeigh = Double.NaN;
                totalWeigh = Double.NaN;
                break;

            default:
                leftWeigh  = Double.NaN;
                rightWeigh = Double.NaN;
                totalWeigh = Double.NaN;
                break;
            }

            GazeWeighed.X = ((GazeData2Weigh.Left.GazePointOnDisplayNormalized.X) * leftWeigh + (GazeData2Weigh.Right.GazePointOnDisplayNormalized.X * rightWeigh)) * totalWeigh;
            GazeWeighed.Y = ((GazeData2Weigh.Left.GazePointOnDisplayNormalized.Y) * leftWeigh + (GazeData2Weigh.Right.GazePointOnDisplayNormalized.Y * rightWeigh)) * totalWeigh;

            return(GazeWeighed);
        }