Exemplo n.º 1
0
        public void SendCalibrationReferenceData()
        {
            Debug.Log("Calculate metrics");

            targetMetricsList.Add(MetricsCalculator.CalculateTargetMetrics(targetDataList));

            if (OnMetricsCalculated != null)
            {
                OnMetricsCalculated();
            }
            //Clear the current target data, so we can proceed to the next target if there is any.
            targetDataList.Clear();
        }
        private void AddSample()
        {
            SampleData pointData = new SampleData();

            pointData.timeStamp           = _gazeProvider.LocalEyeGazeData.Timestamp;
            pointData.isValid             = _gazeProvider.LocalEyeGazeData.isRayValid;
            pointData.exclude             = _isSampleExcluded;
            pointData.targetId            = targetIdx;
            pointData.localMarkerPosition = currLocalTargetPos;
            pointData.worldMarkerPosition = marker.position;
            pointData.cameraPosition      = camera.transform.position;
            pointData.localGazeOrigin     = _gazeProvider.LocalEyeGazeData.Origin;
            pointData.localGazeDirection  = _gazeProvider.LocalEyeGazeData.Direction;
            pointData.worldGazeOrigin     = camera.transform.localToWorldMatrix.MultiplyPoint(_gazeProvider.LocalEyeGazeData.Origin);
            pointData.worldGazeDirection  = camera.transform.localToWorldMatrix.MultiplyVector(_gazeProvider.LocalEyeGazeData.Direction);
            pointData.worldGazeDistance   = _gazeProvider.LocalEyeGazeData.Distance;

            //Calculate sample metrics
            MetricsCalculator.CalculateSampleMetrics(ref pointData, _previousGazeDirection);

            _previousGazeDirection = pointData.worldGazeDirection;

            calibration.AddCalibrationPointReferencePosition(pointData);
        }