コード例 #1
0
        public MyoDataProfile GenerateFramesWithOptions(MyoDataProfile toAnalyze)
        {
            var toReturn = new MyoDataProfile();

            //pose
            if (Options.PoseEnabled)
            {
                toReturn.Pose = (PoseProfileData)toAnalyze.Pose.Clone();
            }
            else
            {
                toReturn.Pose.SetToNone();
            }

            //acceleronometer
            if (Options.AccelNormOnly)
            {
                toReturn.Accel.Normal = toAnalyze.Accel.Normal;
            }
            else if (Options.AccelEnabled)
            {
                toReturn.Accel = (AcceleronmeterProfileData)toAnalyze.Accel.Clone();
            }
            else
            {
                toReturn.Accel.SetToNone();
            }

            //gyroscope
            if (Options.GyroNormOnly)
            {
                toReturn.Gyro.Normal = toAnalyze.Gyro.Normal;
            }
            else if (Options.AccelEnabled)
            {
                toReturn.Gyro = (GyroscopeProfileData)toAnalyze.Gyro.Clone();
            }
            else
            {
                toReturn.Gyro.SetToNone();
            }

            //orientation
            if (Options.OrienHalfMode)
            {
                toReturn.Orien.Azimuth = CommonOperations.GetHalfModeValue(toAnalyze.Orien.Azimuth);
                toReturn.Orien.Roll    = CommonOperations.GetHalfModeValue(toAnalyze.Orien.Roll);
                toReturn.Orien.Pitch   = CommonOperations.GetHalfModeValue(toAnalyze.Orien.Pitch);
            }
            else if (Options.OrienEnabled)
            {
                toReturn.Orien = (OrientationProfileData)toAnalyze.Orien.Clone();
            }
            else
            {
                toReturn.Orien.SetToNone();
            }

            return(toReturn);
        }
コード例 #2
0
        public int GetPoint(OrientationProfileData profile, MyomiGestureOptions options)
        {
            if (!options.OrienEnabled)
            {
                return(CalculatePoint(Result.NotAnalyzed));
            }

            if (options.OrienHalfMode)
            {
                Data.Pitch   = CommonOperations.GetHalfModeValue(Data.Pitch);
                Data.Roll    = CommonOperations.GetHalfModeValue(Data.Roll);
                Data.Azimuth = CommonOperations.GetHalfModeValue(Data.Azimuth);
            }

            int points = 0;
            var result = Analyze(profile.Pitch, Data.Pitch);

            points += CalculatePoint(result);
            result  = Analyze(profile.Roll, Data.Roll);
            points += CalculatePoint(result);
            result  = Analyze(profile.Azimuth, Data.Azimuth);
            points += CalculatePoint(result);
            return(points);
        }