Esempio n. 1
0
        public override bool MatchesCriterion(SkeletonStamp skeletonStamp)
        {
            double alignmentValue = 0.0;

            Joint[] trackedJoints = new Joint[Joints.Length];
            Joint   centerJoint;
            int     i = 0;

            // get the joints to be aligned
            foreach (XmlJointType type in Joints)
            {
                trackedJoints[i++] = skeletonStamp.GetTrackedSkeleton().Joints[type.GetJointType()];
            }
            switch (Alignment)
            {
            case Alignment.Point:
                centerJoint    = skeletonStamp.GetTrackedSkeleton().Joints[CenterJoint.GetJointType()];
                alignmentValue = JointAnalyzer.AreJointsAligned(centerJoint, trackedJoints);
                break;

            case Alignment.Horizontal:
                alignmentValue = JointAnalyzer.AlignedHorizontally(trackedJoints[0], trackedJoints[1]);
                break;

            case Alignment.Vertical:
                alignmentValue = JointAnalyzer.AlignedVertically(trackedJoints[0], trackedJoints[1]);
                break;
            }
            return(alignmentValue > MaximumAcceptedRange);
        }