protected override bool ValidateGestureEndCondition(Body body) { double distance = Math.Abs(startingPosition.X - validatePosition.X); float currentshoulderDiff = GestureHelper.GetJointDistance(body.Joints[JointType.HandLeft], body.Joints[JointType.ShoulderRight]); if (distance > 0.1 && currentshoulderDiff < shoulderDiff) { return(true); } return(false); }
protected override bool ValidateGestureStartCondition(Body body) { var handRightPoisition = body.Joints[JointType.HandRight].Position; var handLeftPosition = body.Joints[JointType.HandLeft].Position; var shoulderLeftPosition = body.Joints[JointType.ShoulderLeft].Position; var spinePosition = body.Joints[JointType.SpineMid].Position; if (//(handLeftPosition.Y < shoulderLeftPosition.Y) && (handLeftPosition.Y > body.Joints[JointType.ElbowLeft].Position.Y) /*&& * handRightPoisition.Y < spinePosition.Y*/) { shoulderDiff = GestureHelper.GetJointDistance(body.Joints[JointType.HandLeft], body.Joints[JointType.ShoulderRight]); validatePosition = body.Joints[JointType.HandLeft].Position; startingPosition = body.Joints[JointType.HandLeft].Position; return(true); } return(false); }
/// <summary> /// Validates the gesture start condition. /// </summary> /// <param name="skeleton">The skeleton.</param> /// <returns></returns> protected override bool ValidateGestureStartCondition(Body skeleton) { var handRightPoisition = skeleton.Joints[JointType.HandRight].Position; var handLeftPosition = skeleton.Joints[JointType.HandLeft].Position; var shoulderRightPosition = skeleton.Joints[JointType.ShoulderRight].Position; var spinePosition = skeleton.Joints[JointType.SpineMid].Position; if ((handRightPoisition.Y < shoulderRightPosition.Y) && (handRightPoisition.Y > skeleton.Joints[JointType.ElbowRight].Position.Y) && (handLeftPosition.Y < spinePosition.Y)) { shoulderDiff = GestureHelper.GetJointDistance(skeleton.Joints[JointType.HandRight], skeleton.Joints[JointType.ShoulderLeft]); validatePosition = skeleton.Joints[JointType.HandRight].Position; startingPosition = skeleton.Joints[JointType.HandRight].Position; return(true); } return(false); }