//给四元组赋值
    void InitQuaternionVector()
    {
        //标准数据入队
        mQueueStdMotion.Enqueue(new MotionJointQuaternionVector(
                                    mStdTransformTorso.position,
                                    mStdTransformTorso.rotation,
                                    mStdTransformLeftHip.rotation,
                                    mStdTransformRightHip.rotation,
                                    mStdTransformLeftShoulder.rotation,
                                    mStdTransformRightShoulder.rotation));

        /*mStdJointQuaternionVector = new MotionJointQuaternionVector
         *      (mStdTransformTorso.position, mStdTransformTorso.rotation,
         *       mStdTransformLeftHip.rotation, mStdTransformRightHip.rotation,
         *       mStdTransformLeftShoulder.rotation, mStdTransformRightShoulder.rotation);*/
        //赋值
        mStdJointQuaternionVector  = mQueueStdMotion.Peek();
        mUserJointQuaternionVector = new MotionJointQuaternionVector
                                         (mUserTransformTorso.position, mUserTransformTorso.rotation,
                                         mUserTransformLeftHip.rotation, mUserTransformRightHip.rotation,
                                         mUserTransformLeftShoulder.rotation, mUserTransformRightShoulder.rotation);
        //若队列已到延时的数据,则出队
        if (mQueueStdMotion.Count > CameraDataDelayFrame)
        {
            mQueueStdMotion.Dequeue();
        }
        //print(mQueueStdMotion.Count);
    }
Example #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public StaticMatch(MotionJointQuaternionVector StdJointQuaternionVector, MotionJointQuaternionVector UserJointQuaternionVector)
 {
     mListMatchScore = new List <float>();
     mListStd        = new List <MotionJointQuaternionVector>();
     mListScore      = new List <float>();
     mStdDistance    = Math.Abs(Vector3.Distance(StdJointQuaternionVector.TorsoPosition, UserJointQuaternionVector.TorsoPosition));
     mRate           = SingletonActionMatchManager.GetInstance().StaticMatchAlogrithmScoreRate;
 }
Example #3
0
    public override void Update(MotionJointQuaternionVector StdJointQuaternionVector, MotionJointQuaternionVector UserJointQuaternionVector)
    {
        if (mListStd.Count < 30)
        {
            mListStd.Add(StdJointQuaternionVector);
        }
        else
        {
            mListStd.RemoveAt(0);
            mListStd.Add(StdJointQuaternionVector);
        }
        //base.Update (StdJointQuaternionVector, UserJointQuaternionVector);
        foreach (MotionJointQuaternionVector stdJointQuaternionVector in mListStd)
        {
            float difTorsoPosition = Math.Abs(Vector3.Distance(stdJointQuaternionVector.TorsoPosition, UserJointQuaternionVector.TorsoPosition));
            float difTorsoRotation = Math.Abs(Quaternion.Angle(stdJointQuaternionVector.TorsoQuaternion, UserJointQuaternionVector.TorsoQuaternion));
            float difLeftHip       = Math.Abs(Quaternion.Angle(stdJointQuaternionVector.LeftHipQuaternion, UserJointQuaternionVector.LeftHipQuaternion));
            float difRightHip      = Math.Abs(Quaternion.Angle(stdJointQuaternionVector.RightHipQuaternion, UserJointQuaternionVector.RightHipQuaternion));
            float difLeftShoulder  = Math.Abs(Quaternion.Angle(stdJointQuaternionVector.LeftShoulderQuaternion, UserJointQuaternionVector.LeftShoulderQuaternion));
            float difRightShoulder = Math.Abs(Quaternion.Angle(stdJointQuaternionVector.RightShoulderQuaternion, UserJointQuaternionVector.RightShoulderQuaternion));
            mTorsoPositionScore = ScoreDistance(difTorsoPosition);
            mTorsoRotationScore = ScoreAngle(difTorsoRotation);
            mLeftHipScore       = ScoreAngle(difLeftHip);
            mRightHipScore      = ScoreAngle(difRightHip);
            mLeftShoulderScore  = ScoreAngle(difLeftShoulder);
            mRightShoulderScore = ScoreAngle(difRightShoulder);
            float totalScore = mTorsoPositionWeight * mTorsoPositionScore + mTorsoRotationWeight * mTorsoRotationScore + mLeftHipWeight * mLeftHipScore + mRightHipWeight * mRightHipScore + mLeftShoulderWeight * mLeftShoulderScore + mRightShoulderWeight * mRightShoulderScore;
            mListScore.Add(totalScore);
        }
        BestScore();

        /*if ( mcount < 10){
         * mListFrameScore.Add(totalScore);
         * mcount++;
         * }
         * else {
         * mcount=0;
         * BestScore();
         * }*/
    }
 public virtual void Update(MotionJointQuaternionVector StdJointQuaternionVector, MotionJointQuaternionVector UserJointQuaternionVector)
 {
     /*mArrayListStdMotionJointQuaternionVector.Add(StdJointQuaternionVector);
      * mArrayListUserMotionJointQuaternionVector.Add(UserJointQuaternionVector);
      */
 }