예제 #1
0
        public Window1()
        {
            InitializeComponent();

            Library.Init();

            _screen = new Screen();

            _browser = new EyetrackerBrowser();
            _browser.EyetrackerFound += _browser_EyetrackerFound;
            _browser.EyetrackerRemoved += _browser_EyetrackerRemoved;
            _browser.EyetrackerUpdated += _browser_EyetrackerUpdated;

            MouseHelper mh = new MouseHelper(camera);
            mh.EventSource = viewPort;

            _eyePair = new EyePair(visualModel);

            const double radius = 0.05;
            DiffuseMaterial cylinderMaterial = new DiffuseMaterial();
            cylinderMaterial.Brush = Brushes.OrangeRed;

            _leftGazeVector = new Cylinder();
            _leftGazeVector.Radius1 = radius;
            _leftGazeVector.Radius2 = radius;
            _leftGazeVector.Material = cylinderMaterial;

            _rightGazeVector = new Cylinder();
            _rightGazeVector.Radius1 = radius;
            _rightGazeVector.Radius2 = radius;
            _rightGazeVector.Material = cylinderMaterial;

            DiffuseMaterial axisMaterial = new DiffuseMaterial(Brushes.Lime);

            Cylinder xAxis = new Cylinder();
            xAxis.Radius1 = radius;
            xAxis.Radius2 = radius;
            xAxis.Point1 = new Point3D(0.0, 0.0, 0.0);
            xAxis.Point2 = new Point3D(1.0, 0.0, 0.0);
            xAxis.Material = axisMaterial;

            Cylinder yAxis = new Cylinder();
            yAxis.Radius1 = radius;
            yAxis.Radius2 = radius;
            yAxis.Point1 = new Point3D(0.0, 0.0, 0.0);
            yAxis.Point2 = new Point3D(0.0, 1.0, 0.0);
            yAxis.Material = axisMaterial;

            Cylinder zAxis = new Cylinder();
            zAxis.Radius1 = radius;
            zAxis.Radius2 = radius;
            zAxis.Point1 = new Point3D(0.0, 0.0, 0.0);
            zAxis.Point2 = new Point3D(0.0, 0.0, 1.0);
            zAxis.Material = axisMaterial;

            visualModel.Children.Add(_leftGazeVector);
            visualModel.Children.Add(_rightGazeVector);
            visualModel.Children.Add(_screen);
            visualModel.Children.Add(xAxis);
            visualModel.Children.Add(yAxis);
            visualModel.Children.Add(zAxis);

            for (int i = 0; i < 12; i++)
            {
                Cylinder edge = new Cylinder();
                edge.Radius1 = 0.1;
                edge.Radius2 = 0.1;
                edge.Point1 = new Point3D(0.0, 0.0, 0.0);
                edge.Point2 = new Point3D(0.0, 0.0, 1.0);
                edge.Material = cylinderMaterial;

                _headBox.Add(edge);
                visualModel.Children.Add(edge);
            }
        }
예제 #2
0
        private void UpdateScreen()
        {
            var config = _tracker.GetXConfiguration();
            Point3D ul = ToWpfPoint3D(config.UpperLeft, 0.1);
            Point3D ur = ToWpfPoint3D(config.UpperRight, 0.1);
            Point3D ll = ToWpfPoint3D(config.LowerLeft, 0.1);

            Screen screen = new Screen(ul,ur,ll);
            visualModel.Children.Remove(_screen);
            _screen = screen;
            visualModel.Children.Add(_screen);
        }