none
Swipe Gesture (Right direction) (Kinect) RRS feed

  • Question

  • Hello,

    I'm trying to write a swipe gesture, where should recognize a swipe to the right. I'm working after the book "Beginning Programming with the Microsoft Kinect SDK" written by Jarrett Webb and James Ashley.

    I've already implemented a swipe to the left, which works fine:

    if (this._swipeLength > 0 && startPoint.X - newPoint.X > _swipeLength)  // check to see if distance has been achieved swipe left         
                {
                    GesturePoints.Clear();
    
                    if ((righthand.Position.X < elbowright.Position.X) && 
                        (righthand.Position.Y < shoulderright.Position.Y) && 
                        (righthand.Position.Y > hipcenter.Position.Y))
                    {
                        //throw local event
                        if (SwipeDetected != null)
                        {
                            SwipeDetected(SwipeType.LEFT);
                            return;
                        }
                    }
                    else
                    {
                        GesturePoints.Clear();
                    }
    

    But I'm having trouble with the swipe to the right: startPoint and newPoint are completely different set - startpoint is bigger the new point, but that's impossible.

    if(this._swipeLength > 0 && newPoint.X - startPoint.X > this._swipeLength) { GesturePoints.Clear(); if ((righthand.Position.X > elbowright.Position.X) && (righthand.Position.X < shoulderright.Position.X + this._swipeLength/2)) { if (SwipeDetected != null) { SwipeDetected(SwipeType.RIGHT); return; } } else { GesturePoints.Clear(); } }

    startpoint and newpoint are set like this: 

    GesturePoint newPoint = new GesturePoint() { X = x, Y = y, Z = z, T = DateTime.Now };
                GesturePoints.Add(newPoint);
    
                GesturePoint startPoint = GesturePoints[0];
    Hope, somebody can give me a hint on how to do that.

    • Moved by Mike Feng Wednesday, December 19, 2012 7:50 AM (From:.NET Base Class Library)
    Tuesday, December 18, 2012 11:36 AM

All replies