Example #1
0
        public void ZeroDeviceOrientationTest()
        {
            Tracker tracker = new Tracker() {Location = new System.Windows.Point(2,4)};
            Device device = new Device() {Location = new System.Windows.Point(7,7)};

            tracker.ZeroDeviceOrientation(device);
            System.Diagnostics.Debug.WriteLine(device.Orientation.Value);

            device.Location = new System.Windows.Point(-7, 7);
            tracker.ZeroDeviceOrientation(device);
            System.Diagnostics.Debug.WriteLine(device.Orientation.Value);

            device.Location = new System.Windows.Point(-7, -7);
            tracker.ZeroDeviceOrientation(device);
            System.Diagnostics.Debug.WriteLine(device.Orientation.Value);

            device.Location = new System.Windows.Point(7, -7);
            tracker.ZeroDeviceOrientation(device);
            System.Diagnostics.Debug.WriteLine(device.Orientation.Value);
        }
Example #2
0
        public TrackerControl(Tracker tracker)
        {
            this._Tracker = tracker;

            InitializeComponent();

            deviceRotationControl = new DeviceRotationControl();
            deviceRotationControl.onSliderValueChanged += new EventHandler<RotationSliderEventArgs>(onOrientationSliderChanged);
            canvas.Children.Add(deviceRotationControl);
            Canvas.SetLeft(deviceRotationControl, -150);
            Canvas.SetTop(deviceRotationControl, -10);
            deviceRotationControl.Opacity = 0;

            TrackerNameLabel.Text = tracker.Identifier;
            LeftLine.StrokeThickness = DrawingResources.TRACKER_FOV_WIDTH;
            RightLine.StrokeThickness = DrawingResources.TRACKER_FOV_WIDTH;

            tracker.LocationChanged += onLocationChanged;
            tracker.OrientationChanged += onOrientationChanged;
            tracker.FOVChanged += onFOVChanged;
            tracker.RangeChanged += onRangeChanged;

            //formatForStackPanel();
        }
Example #3
0
        /// <summary>
        /// This updates the Range drawing for a given tracker
        /// </summary>
        /// <param name="tracker"></param>
        public void updateRange(Tracker tracker)
        {
            double FOVAngle = tracker.FieldOfView.Value / 2;

            // We want to adjust the MinRange triangle, so we're using sin law
            if (tracker.MinRange.HasValue)
            {
                double leftX = (tracker.MinRange.Value * Math.Sin(Util.DEGREES_TO_RADIANS * FOVAngle)) / (Util.DEGREES_TO_RADIANS * (180.0 - FOVAngle - 90));
                double leftXPixels = DrawingResources.ConvertFromMetersToPixelsX(leftX, MainWindow.SharedCanvas);
                double YPixels = DrawingResources.ConvertFromMetersToPixelsY(tracker.MinRange.Value, MainWindow.SharedCanvas);

                NearTriangle.Points.Clear();

                NearTriangle.Points.Add(new Point(50, 15));
                NearTriangle.Points.Add(new Point(50 + leftXPixels, 15+YPixels));
                NearTriangle.Points.Add(new Point(50 - leftXPixels, 15+YPixels));
            }

            // Adjusting the FarLine
            if (tracker.MaxRange.HasValue)
            {
                double leftX = (tracker.MaxRange.Value * Math.Sin(Util.DEGREES_TO_RADIANS * FOVAngle)) / (Util.DEGREES_TO_RADIANS * (180.0 - FOVAngle - 90));
                double leftXPixels = DrawingResources.ConvertFromMetersToPixelsX(leftX, MainWindow.SharedCanvas);
                double YPixels = DrawingResources.ConvertFromMetersToPixelsY(tracker.MaxRange.Value, MainWindow.SharedCanvas);

                FarLine.X1 = 50+ leftXPixels;
                FarLine.Y1 = YPixels;
                FarLine.X2 = 50-leftXPixels;
                FarLine.Y2 = YPixels;
            }
        }
Example #4
0
        /// <summary>
        /// This updates the FOV draw lines for a given tracker
        /// </summary>
        /// <param name="tracker"></param>
        public void updateFOV(Tracker tracker)
        {
            double FOVAngle = tracker.FieldOfView.Value / 2;
            double leftX = (tracker.MaxRange.Value * Math.Sin(Util.DEGREES_TO_RADIANS * FOVAngle)) / (Util.DEGREES_TO_RADIANS * (180.0 - FOVAngle - 90));
            double leftXPixels = DrawingResources.ConvertFromMetersToPixelsX(leftX, MainWindow.SharedCanvas);
            double YPixels = DrawingResources.ConvertFromMetersToPixelsY(tracker.MaxRange.Value, MainWindow.SharedCanvas);

            RightLine.X2 = 50 + leftXPixels;
            RightLine.Y2 = YPixels;
            LeftLine.X2 = 50-leftXPixels;
            LeftLine.Y2 = YPixels;

            //double topAngle = Util.NormalizeAngle(270 + FOVAngle);
            //double topX = Math.Cos(topAngle * Math.PI / 180);
            //double topY = Math.Sin(topAngle * Math.PI / 180);
            //Point newLeft = DrawingResources.ConvertPointToProperLength(new Point(topX, topY), DrawingResources.TRACKER_FOV_LENGTH);
            //LeftLine.X2 = newLeft.X;
            //LeftLine.Y2 = -newLeft.Y;

            //double bottomAngle = Util.NormalizeAngle(270 - FOVAngle);
            //double bottomX = Math.Cos(bottomAngle * Math.PI / 180);
            //double bottomY = Math.Sin(bottomAngle * Math.PI / 180);
            //Point newRight = DrawingResources.ConvertPointToProperLength(new Point(bottomX, bottomY), DrawingResources.TRACKER_FOV_LENGTH);
            //RightLine.X2 = newRight.X;
            //RightLine.Y2 = -newRight.Y;
        }
Example #5
0
 public void onRangeChanged(Tracker tracker)
 {
     updateRange(tracker);
 }
Example #6
0
 void trackerChanged(PersonManager sender, Tracker tracker)
 {
     if (tracker != null)
     {
         //drawnTracker = new DrawnTracker(tracker);
     }
 }
Example #7
0
        void kinectserver_NewKinectDiscovered(string NewKinectID, Point? KinectLocation, Double? KinectOrientation)
        {
            Tracker newTracker = new Tracker(NewKinectID, this.kinectserver);

            locator.Trackers.Add(newTracker);

            newKinectDiscovered(NewKinectID, KinectLocation, KinectOrientation);
        }