/// <summary> /// Handles the gesture tracking. /// </summary> /// <param name="x">The x.</param> /// <param name="y">The y.</param> /// <param name="z">The z.</param> private void HandleGestureTracking(float x, float y, float z) { if (!_gesturePointTrackingEnabled) { return; } // check to see if xOutOfBounds is being used if (_xOutOfBoundsLength != 0 && _initialSwipeX == 0) { _initialSwipeX = x; } GesturePoint newPoint = new GesturePoint() { X = x, Y = y, Z = z, T = DateTime.Now }; GesturePoints.Add(newPoint); GesturePoint startPoint = GesturePoints[0]; var point = new Point(x, y); //check for deviation if (Math.Abs(newPoint.Y - startPoint.Y) > _swipeDeviation) { //Debug.WriteLine("Y out of bounds"); if (SwipeOutOfBoundsDetected != null) { SwipeOutOfBoundsDetected(this, new KinectCursorEventArgs(point) { Z = z, Cursor = _cursorAdorner }); } ResetGesturePoint(GesturePoints.Count); return; } if ((newPoint.T - startPoint.T).Milliseconds > _swipeTime) //check time { GesturePoints.RemoveAt(0); startPoint = GesturePoints[0]; } if ((_swipeLength < 0 && newPoint.X - startPoint.X < _swipeLength) || // check to see if distance has been achieved swipe left (_swipeLength > 0 && newPoint.X - startPoint.X > _swipeLength)) // check to see if distance has been achieved swipe right { GesturePoints.Clear(); //throw local event if (SwipeDetected != null) { SwipeDetected(this, new KinectCursorEventArgs(point) { Z = z, Cursor = _cursorAdorner }); } return; } if (_xOutOfBoundsLength != 0 && ((_xOutOfBoundsLength < 0 && newPoint.X - _initialSwipeX < _xOutOfBoundsLength) || // check to see if distance has been achieved swipe left (_xOutOfBoundsLength > 0 && newPoint.X - _initialSwipeX > _xOutOfBoundsLength)) ) { if (SwipeOutOfBoundsDetected != null) { SwipeOutOfBoundsDetected(this, new KinectCursorEventArgs(point) { Z = z, Cursor = _cursorAdorner }); } } }