using KinectUtils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Kinect;
using System.Threading;
namespace MyGestureBank
{
///
/// The hand up right posture.
///
public class PostureHandUpRight : Posture
{
///
/// PostureHandUpRight constructor.
///
public PostureHandUpRight()
{
GestureName = "HandUpRight";
}
///
/// The test gesture method.
///
///
public override void TestGesture(Body body)
{
if(TestPosture(body))
{
Console.WriteLine("Gesture recognized, hand up right");
Thread.Sleep(1000);
OnGestureRecognized();
}
}
///
/// Tests the posture.
///
///
/// A boolean indicating wheter the posture was detected or not.
protected override bool TestPosture(Body body)
{
return body.Joints[JointType.HandRight].Position.Y > body.Joints[JointType.SpineShoulder].Position.Y &&
body.Joints[JointType.HandLeft].Position.Y < body.Joints[JointType.SpineShoulder].Position.Y;
}
}
}