Пример #1
0
        /// <summary>
        /// determine if user did not bring barbell up high enough
        /// </summary>
        static public ExerciseError GetTopError(TopBottomPoints topbottompoints)
        {
            ExerciseError ErrorTop = new ExerciseError("Make sure you bring the bar all the way up.");  //initialize ExerciseError with this problem's advice

            if (topbottompoints.TopY < topbottompoints.TopSkeleton.Joints[JointType.ShoulderLeft].Position.Y)
            {
                ErrorTop.WasError = true;  //if user didn't bring bar up to shoulder, they made an error
            }
            return(ErrorTop);
        }
Пример #2
0
        /// <summary>
        /// determine if user did not allow barbell to go low enough
        /// </summary>
        public static ExerciseError GetBottomError(TopBottomPoints topbottompoints)
        {
            ExerciseError ErrorBottom = new ExerciseError("Make sure you allow the bar to go all the way down to your starting position.");  //initialize ExerciseError with this problem's advice

            if (topbottompoints.BottomY > topbottompoints.TopSkeleton.Joints[JointType.HipCenter].Position.Y)
            {
                ErrorBottom.WasError = true;  //if user didn't bring bar below hip, they made an error
            }
            return ErrorBottom;
        }
Пример #3
0
 /// <summary>
 /// determine if user was too fast or too slow on the downtake motion of exercise
 /// </summary>
 public static ExerciseError GetBodyRockError(Skeleton[] skelarray)
 {
     float MaxAllowedZDistance = 1.0F;  // maximum amount of Z-coord difference between Hip and Shoulder points
     ExerciseError BodyRockError = new ExerciseError("Keep your back straight while performing exercise");  //initialize ExerciseError with this problem's advice
     float MaxMeasuredZDistance = 0;
     for (int i = 0; i < skelarray.Length; i++)
     {
         float ShoulderHipZDistance = skelarray[i].Joints[JointType.ShoulderCenter].Position.Z - skelarray[i].Joints[JointType.HipCenter].Position.Z;
         if (ShoulderHipZDistance > MaxMeasuredZDistance)
         {
             MaxMeasuredZDistance = ShoulderHipZDistance;  //determine maximum amount of Z-coord difference between Hip and Shoulder points in all frames
         }
     }
     if (MaxMeasuredZDistance > MaxAllowedZDistance)
     {
         BodyRockError.WasError = true;  //if user's Hip to Shoulder Z-coord difference is too off, they made an error
     }
     return BodyRockError;
 }
Пример #4
0
        /// <summary>
        /// determine if user was too fast or too slow on the downtake motion of exercise
        /// </summary>
        static public ExerciseError GetBodyRockError(Skeleton[] skelarray)
        {
            float         MaxAllowedZDistance  = 1.0F;                                                                   // maximum amount of Z-coord difference between Hip and Shoulder points
            ExerciseError BodyRockError        = new ExerciseError("Keep your back straight while performing exercise"); //initialize ExerciseError with this problem's advice
            float         MaxMeasuredZDistance = 0;

            for (int i = 0; i < skelarray.Length; i++)
            {
                float ShoulderHipZDistance = skelarray[i].Joints[JointType.ShoulderCenter].Position.Z - skelarray[i].Joints[JointType.HipCenter].Position.Z;
                if (ShoulderHipZDistance > MaxMeasuredZDistance)
                {
                    MaxMeasuredZDistance = ShoulderHipZDistance;  //determine maximum amount of Z-coord difference between Hip and Shoulder points in all frames
                }
            }
            if (MaxMeasuredZDistance > MaxAllowedZDistance)
            {
                BodyRockError.WasError = true;  //if user's Hip to Shoulder Z-coord difference is too off, they made an error
            }
            return(BodyRockError);
        }
Пример #5
0
        /// <summary>
        /// determine if user was too fast or too slow on the downtake motion of exercise
        /// </summary>
        static public ExerciseError GetSpeedErrorDowntake(TopBottomPoints topbottompoints, int skellength)
        {
            ExerciseError SpeedUp         = new ExerciseError("Try to speed up a bit when letting the weight back down"); //initialize ExerciseError with this problem's advice
            ExerciseError SlowDown        = new ExerciseError("Try to slow down a bit when letting the weight back down.  If this is too difficult, try lowering the amount of weight you are using.");
            int           SlowFrameAmount = 40;                                                                           //maximum allowed frame length for exercise
            int           FastFrameAmount = 20;                                                                           //minimum allowed frame length for exercise
            int           downframeamount = skellength - topbottompoints.TopFrame;

            if (downframeamount < FastFrameAmount)
            {
                SpeedUp.WasError = true;  //if user's downtake motion had less frames than allowed, they went too fast
                return(SpeedUp);
            }
            else if (downframeamount > SlowFrameAmount)
            {
                SlowDown.WasError = true;  //if user's downtake motion had more frames than allowed, they went too slow
                return(SlowDown);
            }
            else
            {
                SpeedUp.WasError = false;  //otherwise, user made no downtake speed error
                return(SpeedUp);
            }
        }
Пример #6
0
        /// <summary>
        /// determine if user was too fast or too slow on the downtake motion of exercise
        /// </summary>
        public static ExerciseError GetSpeedErrorDowntake(TopBottomPoints topbottompoints, int skellength)
        {
            ExerciseError SpeedUp = new ExerciseError("Try to speed up a bit when letting the weight back down");  //initialize ExerciseError with this problem's advice
            ExerciseError SlowDown = new ExerciseError("Try to slow down a bit when letting the weight back down.  If this is too difficult, try lowering the amount of weight you are using.");
            int SlowFrameAmount = 40;  //maximum allowed frame length for exercise
            int FastFrameAmount = 20;  //minimum allowed frame length for exercise
            int downframeamount = skellength - topbottompoints.TopFrame;

            if (downframeamount < FastFrameAmount)
            {
                SpeedUp.WasError = true;  //if user's downtake motion had less frames than allowed, they went too fast
                return SpeedUp;
            }
            else if (downframeamount > SlowFrameAmount)
            {
                SlowDown.WasError = true;  //if user's downtake motion had more frames than allowed, they went too slow
                return SlowDown;
            }
            else
            {
                SpeedUp.WasError = false;  //otherwise, user made no downtake speed error
                return SpeedUp;
            }
        }
Пример #7
0
        /// <summary>
        /// determine if user did not bring barbell up high enough
        /// </summary>
        public static ExerciseError GetTopError(TopBottomPoints topbottompoints)
        {
            ExerciseError ErrorTop = new ExerciseError("Make sure you bring the bar all the way up.");  //initialize ExerciseError with this problem's advice

            if (topbottompoints.TopY < topbottompoints.TopSkeleton.Joints[JointType.ShoulderLeft].Position.Y)
            {
                ErrorTop.WasError = true;  //if user didn't bring bar up to shoulder, they made an error
            }
            return ErrorTop;
        }
Пример #8
0
        /// <summary>
        /// determine if user was too fast or too slow on the uptake motion of exercise
        /// </summary>
        public static ExerciseError GetSpeedErrorUptake(TopBottomPoints topbottompoints)
        {
            ExerciseError SpeedUp = new ExerciseError("Try to speed up a bit when pulling the weight up towards you.  If this is too difficult, try lowering the amount of weight you are using.");
            ExerciseError SlowDown = new ExerciseError("Try to slow down a bit when pulling the weight up towards you.");  //initialize ExerciseError with this problem's advice

            int SlowFrameAmount = 40;  //maximum allowed frame length for uptake of exercise
            int FastFrameAmount = 20;  //minimum allowed frame length for uptake exercise
            int upframeamount = topbottompoints.TopFrame - topbottompoints.BottomFrame;
            if (upframeamount < FastFrameAmount)
            {
                SpeedUp.WasError = true;  //if user's uptake motion had less frames than allowed, they went too fast
                return SpeedUp;
            }
            else if (upframeamount > SlowFrameAmount)
            {
                SlowDown.WasError = true;  //if user's uptake motion had more frames than allowed, they went too slow
                return SlowDown;
            }
            else
            {
                SpeedUp.WasError = false;  //otherwise, user made no uptake speed error
                return SpeedUp;
            }
        }