public ConnectedJoint() { // Used for serialization. this.jointID = -1; this.nextJoint = null; this.childGestureRulesCollection = new List<ChildGestureRules>(); }
public ConnectedJoint(JointType jointType, int jointID) { this.jointType = jointType; this.jointID = jointID; this.nextJoint = null; this.childGestureRulesCollection = new List<ChildGestureRules>(); }
public ConnectedJoint(JointType jointType, int jointID) { this.jointType = jointType; this.jointID = jointID; this.nextJoint = null; this.childGestureRulesCollection = new List <ChildGestureRules>(); }
public ConnectedJoint() { // Used for serialization. this.jointID = -1; this.nextJoint = null; this.childGestureRulesCollection = new List <ChildGestureRules>(); }
public void AddChildJointAngleRule(Joint thisJoint, Joint otherJoint, ConnectedJoint otherConnectedJoint, double tolerance) { double angle = GetJointPairAngle(thisJoint, otherJoint); double[] rule = new double[] { angle - tolerance, angle + tolerance }; AngleGestureRule gestureRule = new AngleGestureRule(rule); AddChildJointRule(gestureRule, otherConnectedJoint); }
public void AddChildJointRule(AngleGestureRule gestureRule, ConnectedJoint connectedJoint) { ChildGestureRules childGestureRules = childGestureRulesCollection.Find(gr => gr.ChildID == connectedJoint.ID); if (childGestureRules != null) { childGestureRules.AddGestureRule(gestureRule); } else { childGestureRules = new ChildGestureRules(connectedJoint.ID, gestureRule); childGestureRulesCollection.Add(childGestureRules); } }
private bool DoesParentSatisfyRules(ConnectedJoint connectedJoint, List <Joint> skeletonJoints) { bool satisfyRules = true; Joint thisJoint; ConnectedJoint child; // Extract this joint. If it's null, the gesture will not be found; return false. Remove // this joint from the collection, since it's a parent and will no longer be traversed. thisJoint = skeletonJoints.Find(joint => joint.JointType == connectedJoint.JointType); if (thisJoint == null) { return(false); } skeletonJoints.RemoveAll(joint => joint.JointType == connectedJoint.JointType); foreach (Joint joint in skeletonJoints) { child = connectedJoints.Find(cj => cj.JointType == joint.JointType); satisfyRules &= child != null && connectedJoint.DoesChildMeetGestureRules(child.ID, thisJoint, joint); if (!satisfyRules) { break; } } if (connectedJoint.NextJoint == null) { return(satisfyRules); } else if (!satisfyRules) { // If false already, exit the traversal. return(satisfyRules); } else { return(satisfyRules && DoesParentSatisfyRules(connectedJoint.NextJoint, skeletonJoints)); } }
private bool DoesParentSatisfyRules(ConnectedJoint connectedJoint, List<Joint> skeletonJoints) { bool satisfyRules = true; Joint thisJoint; ConnectedJoint child; // Extract this joint. If it's null, the gesture will not be found; return false. Remove // this joint from the collection, since it's a parent and will no longer be traversed. thisJoint = skeletonJoints.Find(joint => joint.JointType == connectedJoint.JointType); if (thisJoint == null) return false; skeletonJoints.RemoveAll(joint => joint.JointType == connectedJoint.JointType); foreach (Joint joint in skeletonJoints) { child = connectedJoints.Find(cj => cj.JointType == joint.JointType); satisfyRules &= child != null && connectedJoint.DoesChildMeetGestureRules(child.ID, thisJoint, joint); if (!satisfyRules) break; } if (connectedJoint.NextJoint == null) { return satisfyRules; } else if(!satisfyRules) { // If false already, exit the traversal. return satisfyRules; } else { return satisfyRules && DoesParentSatisfyRules(connectedJoint.NextJoint, skeletonJoints); } }