示例#1
0
        /// <summary>
        /// determine the frames at which maximum and minimum height of barbell occur, their max and min Y values, and those frames' associated skeletons
        /// </summary>
        public static TopBottomPoints DetermineTopandBottom(List<Skeleton> data)
        {
            Skeleton[] skeldata = data.ToArray();
            TopBottomPoints topbottompoints = new TopBottomPoints(skeldata);

            for (int i = 0; i < skeldata.Length; i++)
            {
                Skeleton skeleton = skeldata[i];
                float leftwristY = skeleton.Joints[JointType.WristLeft].Position.Y;
                float rightwristY = skeleton.Joints[JointType.WristRight].Position.Y;
                float avewristdist = (leftwristY + rightwristY) / 2;  //compute average Y-value for this frames left and right wrist positions
                if (avewristdist > topbottompoints.TopY)  //determine maximum wrist Y-value in all frames
                {
                    topbottompoints.TopY = avewristdist;
                    topbottompoints.TopFrame = i;
                }
                if (avewristdist < topbottompoints.BottomY)  //determine minimum wrist Y-value in all frames
                {
                    topbottompoints.BottomY = avewristdist;
                    topbottompoints.BottomFrame = i;
                }

            }
            topbottompoints.BottomSkeleton = skeldata[topbottompoints.BottomFrame];
            topbottompoints.TopSkeleton = skeldata[topbottompoints.TopFrame];
            return topbottompoints;
        }
示例#2
0
        /// <summary>
        /// determine if user was too fast or too slow on the uptake motion of exercise
        /// </summary>
        static public 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);
            }
        }
示例#3
0
        /// <summary>
        /// determine the frames at which maximum and minimum height of barbell occur, their max and min Y values, and those frames' associated skeletons
        /// </summary>
        static public TopBottomPoints DetermineTopandBottom(List <Skeleton> data)
        {
            Skeleton[]      skeldata        = data.ToArray();
            TopBottomPoints topbottompoints = new TopBottomPoints(skeldata);

            for (int i = 0; i < skeldata.Length; i++)
            {
                Skeleton skeleton     = skeldata[i];
                float    leftwristY   = skeleton.Joints[JointType.WristLeft].Position.Y;
                float    rightwristY  = skeleton.Joints[JointType.WristRight].Position.Y;
                float    avewristdist = (leftwristY + rightwristY) / 2; //compute average Y-value for this frames left and right wrist positions
                if (avewristdist > topbottompoints.TopY)                //determine maximum wrist Y-value in all frames
                {
                    topbottompoints.TopY     = avewristdist;
                    topbottompoints.TopFrame = i;
                }
                if (avewristdist < topbottompoints.BottomY)  //determine minimum wrist Y-value in all frames
                {
                    topbottompoints.BottomY     = avewristdist;
                    topbottompoints.BottomFrame = i;
                }
            }
            topbottompoints.BottomSkeleton = skeldata[topbottompoints.BottomFrame];
            topbottompoints.TopSkeleton    = skeldata[topbottompoints.TopFrame];
            return(topbottompoints);
        }
示例#4
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;
        }
示例#5
0
        /// <summary>
        /// determine if user did not allow barbell to go low enough
        /// </summary>
        static public 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);
        }
示例#6
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);
        }
示例#7
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;
            }
        }
示例#8
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);
            }
        }
示例#9
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;
        }
示例#10
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;
            }
        }