Ejemplo n.º 1
0
        public float[] ToCoordinates(AdditionalDimensionsConfguration config)
        {
            float[] coordinates = new float[config.CoordinatesCount];

            int index = 0;

            coordinates[index++] = gaze_point.X;
            coordinates[index++] = gaze_point.Y;

            foreach (var vector3 in new List <Tuple <Tobii.Interaction.Vector3, Vector3Percents> > {
                new Tuple <Tobii.Interaction.Vector3, Vector3Percents> (left_eye, config.LeftEye),
                new Tuple <Tobii.Interaction.Vector3, Vector3Percents> (right_eye, config.RightEye),
                new Tuple <Tobii.Interaction.Vector3, Vector3Percents> (AngleBetweenEyes, config.AngleBetweenEyes),
                new Tuple <Tobii.Interaction.Vector3, Vector3Percents> (head_direction, config.HeadDirection),
                new Tuple <Tobii.Interaction.Vector3, Vector3Percents> (head_position, config.HeadPosition)
            })
            {
                if (vector3.Item2.X > 0)
                {
                    coordinates[index++] = (float)vector3.Item1.X;
                }
                if (vector3.Item2.Y > 0)
                {
                    coordinates[index++] = (float)vector3.Item1.Y;
                }
                if (vector3.Item2.Z > 0)
                {
                    coordinates[index++] = (float)vector3.Item1.Z;
                }
            }
            return(coordinates);
        }
Ejemplo n.º 2
0
 public bool Equals(AdditionalDimensionsConfguration other)
 {
     return
         (LeftEye.Equals(other.LeftEye) &&
          RightEye.Equals(other.RightEye) &&
          AngleBetweenEyes.Equals(other.AngleBetweenEyes) &&
          HeadDirection.Equals(other.HeadDirection) &&
          HeadPosition.Equals(other.HeadPosition));
 }
Ejemplo n.º 3
0
        public void OnCursorPositionUpdate(float[] cursor_position)
        {
            string head_position_description = "";
            Color  color = Colors.Red;

            lock (Helpers.locker)
            {
                AdditionalDimensionsConfguration configuration = Options.Instance.calibration_mode.additional_dimensions_configuration;
                if (!configuration.Equals(AdditionalDimensionsConfguration.Disabled))
                {
                    color = color_calculator.GetColor(cursor_position);
                    int coordinate_index = 2;
                    foreach (var vector3 in new List <Tuple <string, Vector3Percents> > {
                        new Tuple <string, Vector3Percents> ("Left eye", configuration.LeftEye),
                        new Tuple <string, Vector3Percents> ("Right eye", configuration.RightEye),
                        new Tuple <string, Vector3Percents> ("Angle between eyes", configuration.AngleBetweenEyes),
                        new Tuple <string, Vector3Percents> ("Head direction", configuration.HeadDirection),
                        new Tuple <string, Vector3Percents> ("Head position", configuration.HeadPosition)
                    })
                    {
                        if (!vector3.Item2.Equals(Vector3Percents.Disabled))
                        {
                            head_position_description += vector3.Item1 + " \n";
                        }
                        if (vector3.Item2.X > 0)
                        {
                            head_position_description += "X: " + (int)cursor_position[coordinate_index++] + "\n";
                        }
                        if (vector3.Item2.Y > 0)
                        {
                            head_position_description += "Y: " + (int)cursor_position[coordinate_index++] + "\n";
                        }
                        if (vector3.Item2.Z > 0)
                        {
                            head_position_description += "Z: " + (int)cursor_position[coordinate_index++] + "\n";
                        }
                    }
                }
            }

            Dispatcher.BeginInvoke(new Action(() =>
            {
                CurrentHeadPositionColor.Background = new SolidColorBrush(color);
                HeadPositionDescription.Text        = head_position_description;
            }));
        }
Ejemplo n.º 4
0
        public void UpdateTobiiStreams(object sender, EventArgs e)
        {
            lock (Helpers.locker)
            {
                AdditionalDimensionsConfguration config = Options.Instance.calibration_mode.additional_dimensions_configuration;
                head_pose_stream.IsEnabled =
                    !config.HeadPosition.Equals(Vector3Percents.Disabled) ||
                    !config.HeadDirection.Equals(Vector3Percents.Disabled);

                eye_position_stream.IsEnabled =
                    !config.LeftEye.Equals(Vector3Percents.Disabled) ||
                    !config.RightEye.Equals(Vector3Percents.Disabled) ||
                    !config.AngleBetweenEyes.Equals(Vector3Percents.Disabled);

                Debug.Assert(config.AngleBetweenEyes.Z == null);
            }
        }