Beispiel #1
0
        private static List <PoseError> CompareAngleForBone(BoneType reference, PlaneBasedBodyAngles current, PlaneBasedBodyAngles target, float tolerance)
        {
            var ret = new List <PoseError>();

            foreach (var entry in target.angles[reference])
            {
                var targetAngle = entry.Value;
                var actualAngle = current.GetAngle(reference, entry.Key);
                if (!IsAngleWithinInterval(actualAngle, targetAngle, tolerance))
                {
                    //TODO calculate the error margin
                    float margin = (targetAngle - tolerance);

                    //mark the pair of bones as an error
                    var error = new PoseError(target.plane, reference, entry.Key, margin);
                    ret.Add(error);
                }
                else
                {
                    //if we need to do something when its right
                }
            }

            return(ret);
        }
Beispiel #2
0
        //compares all the bones from the passed body to the PlaneBasedBodyPose(a targetBodyAngles in only one default plane)
        //returns a List of PoseError that tells which bones were off and the default plane they were judged
        public static List <PoseError> ComparePlaneBasedBodyAngles(PlaneBasedBodyAngles currentBodyAngles, PlaneBasedBodyAngles targetBodyAngles, float tolerance)
        {
            List <PoseError> totalErrors = new List <PoseError>();

            foreach (var entry in targetBodyAngles.angles)
            {
                var type = entry.Key;

                List <PoseError> localErrors;
                localErrors = CompareAngleForBone(type, currentBodyAngles, targetBodyAngles, tolerance);

                foreach (var error in localErrors)
                {
                    totalErrors.Add(error);
                }
            }

            return(totalErrors);
        }