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); } }
public bool DoesChildMeetGestureRules(int childID, Joint thisJoint, Joint childJoint) { // Returns true if the child meets the specified rule. If there is no rule for the child in this ConnectedJoint, // then the child still meets the rule; return true; bool childMeetsRule = true; ChildGestureRules childGestureRules = childGestureRulesCollection.Find(c => c.ChildID == childID); if (childGestureRules == null || childGestureRules.GestureRules == null || childGestureRules.GestureRules.Count == 0) { return(childMeetsRule); } double jointPairAngle = GetJointPairAngle(thisJoint, childJoint); foreach (AngleGestureRule gestureRule in childGestureRules.GestureRules) { childMeetsRule = gestureRule.DoesValueMeetRule(jointPairAngle); } return(childMeetsRule); }