public float GetRelationshipInfo(KinectJoint actor, KinectJointRelationship relation, string relative)
 {
     if (this.thisKinectGesturePlugin == null)
     {
         return(float.NaN);
     }
     if (this.thisKinectGesturePlugin.gestureProcessor == null)
     {
         return(float.NaN);
     }
     if (this.thisKinectGesturePlugin.gestureProcessor.Skeletons == null)
     {
         return(float.NaN);
     }
     Microsoft.Kinect.Skeleton skeleton = null;
     foreach (Microsoft.Kinect.Skeleton s in this.thisKinectGesturePlugin.gestureProcessor.Skeletons)
     {
         if (s.TrackingState != Microsoft.Kinect.SkeletonTrackingState.NotTracked)
         {
             skeleton = s; break;
         }
     }
     if (skeleton != null)
     {
         if (this.thisKinectGesturePlugin.gestureProcessor.Relationships.ContainsKey(skeleton.TrackingId))
         {
             if (this.thisKinectGesturePlugin.gestureProcessor.Relationships[skeleton.TrackingId].ContainsKey((Microsoft.Kinect.JointType)actor))
             {
                 if (this.thisKinectGesturePlugin.gestureProcessor.Relationships[skeleton.TrackingId][(Microsoft.Kinect.JointType)actor].ContainsKey(relative))
                 {
                     if (this.thisKinectGesturePlugin.gestureProcessor.Relationships[skeleton.TrackingId][(Microsoft.Kinect.JointType)actor][relative].ContainsKey((GestureParser.Relationship)relation))
                     {
                         return(this.thisKinectGesturePlugin.gestureProcessor.Relationships[skeleton.TrackingId][(Microsoft.Kinect.JointType)actor][relative][(GestureParser.Relationship)relation]);
                     }
                     return(float.NaN);
                 }
                 return(float.NaN);
             }
             return(float.NaN);
         }
         return(float.NaN);
     }
     return(float.NaN);
 }
 // Exposes the library's ability to add a gesture step's failure condition
 public int AddGestureStepFailureRelationship(KinectJoint actor, KinectJointRelationship relationship, string relative, int deviation, int stepNumber = -1, string gestureName = null)
 {
     if (gestureName != null)
     {
         lastGesture = GetGesture(gestureName);
     }
     if (stepNumber != -1)
     {
         lastStep = stepNumber;
     }
     GestureParser.JointRelationship jr = new GestureParser.JointRelationship()
     {
         actor     = (Microsoft.Kinect.JointType)actor,
         relation  = (GestureParser.Relationship)relationship,
         relative  = relative,
         deviation = deviation
     };
     lastGesture.steps.ElementAt(lastStep).FailureConditions.Add(jr);
     lastFailureCondition = (lastGesture.steps.ElementAt(lastStep).FailureConditions.Count - 1);
     return(lastFailureCondition);
 }
 public void SetGestureStepFailureRelationship(string gestureName, int stepNumber, int conditionNumber, KinectJoint actor, KinectJointRelationship relationship, string relative, int deviation = 0)
 {
     this.thisKinectGesturePlugin.SetGestureStepFailureRelationship(gestureName, stepNumber, conditionNumber, actor, relationship, relative, deviation);
 }
 public int AddGestureStepFailureRelationship(KinectJoint actor, KinectJointRelationship relationship, string relative, int deviation, int stepNumber = -1, string gestureName = null)
 {
     return(this.thisKinectGesturePlugin.AddGestureStepFailureRelationship(actor, relationship, relative, deviation, stepNumber, gestureName));
 }
 // Exposes the library's ability to set a gesture step's failure relationship
 public void SetGestureStepFailureRelationship(string gestureName, int stepNumber, int conditionNumber, KinectJoint actor, KinectJointRelationship relationship, string relative, int deviation = 0)
 {
     lastGesture = GetGesture(gestureName);
     lastStep    = stepNumber;
     lastGesture.steps.ElementAt(stepNumber).FailureConditions.ElementAt(conditionNumber).actor     = (Microsoft.Kinect.JointType)actor;
     lastGesture.steps.ElementAt(stepNumber).FailureConditions.ElementAt(conditionNumber).relation  = (GestureParser.Relationship)relationship;
     lastGesture.steps.ElementAt(stepNumber).FailureConditions.ElementAt(conditionNumber).relative  = relative;
     lastGesture.steps.ElementAt(stepNumber).FailureConditions.ElementAt(conditionNumber).deviation = deviation;
 }