コード例 #1
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
 public ConnectedJoint()
 {
     // Used for serialization.
     this.jointID = -1;
     this.nextJoint = null;
     this.childGestureRulesCollection = new List<ChildGestureRules>();
 }
コード例 #2
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
 public ConnectedJoint(JointType jointType, int jointID)
 {
     this.jointType = jointType;
     this.jointID = jointID;
     this.nextJoint = null;
     this.childGestureRulesCollection = new List<ChildGestureRules>();
 }
コード例 #3
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
 public ConnectedJoint(JointType jointType, int jointID)
 {
     this.jointType = jointType;
     this.jointID   = jointID;
     this.nextJoint = null;
     this.childGestureRulesCollection = new List <ChildGestureRules>();
 }
コード例 #4
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
 public ConnectedJoint()
 {
     // Used for serialization.
     this.jointID   = -1;
     this.nextJoint = null;
     this.childGestureRulesCollection = new List <ChildGestureRules>();
 }
コード例 #5
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
        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);
        }
コード例 #6
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
        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);
            }
        }
コード例 #7
0
ファイル: GestureTree.cs プロジェクト: rjabaker/Skynet
        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));
            }
        }
コード例 #8
0
ファイル: GestureTree.cs プロジェクト: rjabaker/Skynet
        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);
            }
        }
コード例 #9
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
        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);
            }
        }
コード例 #10
0
ファイル: ConnectedJoint.cs プロジェクト: rjabaker/Skynet
        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);
        }