コード例 #1
0
    /// <summary>
    /// 接收两个轨迹数据,(用于轨迹分析),每一帧调用
    /// </summary>
    /// <param name="refData">参考数据,此数据作为参考对象</param>
    /// <param name="AppraiseData">分析数据,需要对此数据进行分析</param>
    public void RecvCompairTrailData(ModelCtrlData refData, ModelCtrlData AppraiseData)
    {
        TrailCurveDrawCtrl.Instance().studyMotion.getTraj(0).add(AppraiseData.toLeftTPose());
        TrailCurveDrawCtrl.Instance().studyMotion.getTraj(1).add(AppraiseData.toRightTPose());

        if (cur_frame < 5)
        {
            deta_left  += new Vec3(AppraiseData.bodyCtrlData.HandLeftPos - refData.bodyCtrlData.HandLeftPos);
            deta_right += new Vec3(AppraiseData.bodyCtrlData.HandRightPos - refData.bodyCtrlData.HandRightPos);

            if (cur_frame == 4)
            {
                deta_left  /= 5;
                deta_right /= 5;
            }
            left_color_list.Add(0.0f);
            right_color_list.Add(0.0f);
            if (cur_frame == 0)
            {
                TrailCurveDrawCtrl.Instance().startDraw(true);
            }
        }
        else
        {
            left_color_list.Add(Math.Abs((float)(new Vec3(AppraiseData.bodyCtrlData.HandLeftPos - refData.bodyCtrlData.HandLeftPos) - deta_left).norm()));
            right_color_list.Add(Math.Abs((float)(new Vec3(AppraiseData.bodyCtrlData.HandRightPos - refData.bodyCtrlData.HandRightPos) - deta_right).norm()));
        }
        cur_frame++;
    }
コード例 #2
0
 void Update()
 {
     length    = TrailCurveDrawCtrl.Instance().curve_length;
     end_index = (int)motion.getTraj(cur_traj).size();
     if (end_index - start_index >= length)
     {
         start_index = end_index - length;
     }
 }
コード例 #3
0
    void OnEnable()
    {
        motion = TrailCurveDrawCtrl.Instance().curMotion;
        hand   = new GameObject();

        length      = TrailCurveDrawCtrl.Instance().curve_length;
        start_index = 0;
        end_index   = (int)motion.getTraj(cur_traj).size();
    }
コード例 #4
0
    public static TrailCurveDrawCtrl Instance()
    {
        if (trajctrl == null)
        {
            trajctrl = new TrailCurveDrawCtrl();
        }

        return(trajctrl);
    }
コード例 #5
0
    void OnEnable()
    {
        motion = TrailCurveDrawCtrl.Instance().studyMotion;
        hand   = new GameObject();

        length      = TrailCurveDrawCtrl.Instance().curve_length;
        start_index = 0;
        end_index   = (int)motion.getTraj(cur_traj).size();

        left_color_list  = TrailCurveAppraiseCtrl.left_color_list;
        right_color_list = TrailCurveAppraiseCtrl.left_color_list;
    }
コード例 #6
0
    // Use this for initialization
    void OnEnable()
    {
        motion = TrailCurveDrawCtrl.Instance().curMotion;
        //isPlay = TrailCurveDrawCtrl.Instance().getIsPlay();
        length = TrailCurveDrawCtrl.Instance().curve_length;

        start_index = 0;
        end_index   = (int)motion.getTraj(cur_traj).size();
        for (int i = 0; i < motion.size(); ++i)
        {
            initLineRenderer(i, Color.red, Color.red, 0.04f, 0.04f);
        }

        /*残影部分gameobject初始化
         * root1 = GameObject.Find("GameObject1");
         * root2 = GameObject.Find("GameObject2");
         * hand1 = root1.transform.Find("lefthand").gameObject;
         **/
    }
コード例 #7
0
    //根据之前的分析给出评分
    public float AppraiseTrailCurve()
    {
        float deta = 0.0f;

        for (int i = 0; i < cur_frame; ++i)
        {
            deta += left_color_list[i] + right_color_list[i];
        }
        //deta /= 20;

        float DTW_score_left  = compareTrailCurveWithDTW(TrailCurveDrawCtrl.Instance().curMotion.getTraj(0), TrailCurveDrawCtrl.Instance().studyMotion.getTraj(0));
        float DTW_score_right = compareTrailCurveWithDTW(TrailCurveDrawCtrl.Instance().curMotion.getTraj(1), TrailCurveDrawCtrl.Instance().studyMotion.getTraj(1));

        if ((DTW_score_left + DTW_score_right) / 2 > 0.0f)
        {
            return((DTW_score_left + DTW_score_right) / 2);
        }
        else
        {
            return((100.0f - deta) > 0.0f ? (100.0f - deta) : 0.0f);
        }
    }
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        if (bIsStart)
        {
            m_RefRateController.nCurrentFrame += 1;
            m_RateController.nCurrentFrame    += 1;

            m_StudyController.Update((int)m_RefRateController.nCurrentFrame, (int)m_RateController.nCurrentFrame);
            m_StudyModeChartController.UpdateRefLineChart(ChartType.CHART_SPEED, m_RefRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastSpeed(TrailType.EG_S1));
            m_StudyModeChartController.UpdateRefLineChart(ChartType.CHART_ACCELERATE, m_RefRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastAcceleration(TrailType.EG_S1));
            m_StudyModeChartController.UpdateRefLineChart(ChartType.CHART_CURVATURE, m_RefRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastCurvature(TrailType.EG_S1));
            m_StudyModeChartController.UpdateRefLineChart(ChartType.CHART_TORSION, m_RefRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastTorsion(TrailType.EG_S1));
            m_StudyModeChartController.UpdateLineChart(ChartType.CHART_SPEED, m_RateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastSpeed(TrailType.EG_S1, true));
            m_StudyModeChartController.UpdateLineChart(ChartType.CHART_ACCELERATE, m_RateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastAcceleration(TrailType.EG_S1, true));
            m_StudyModeChartController.UpdateLineChart(ChartType.CHART_CURVATURE, m_RateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastCurvature(TrailType.EG_S1, true));
            m_StudyModeChartController.UpdateLineChart(ChartType.CHART_TORSION, m_RateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastTorsion(TrailType.EG_S1, true));

            if (!bIsRecord)
            {
                if (m_RefRateController.nCurrentFrame >= m_RefRateController.nTotalFrameCount ||
                    m_RateController.nCurrentFrame >= m_RateController.nTotalFrameCount)
                {
                    GetComponent <StudyModelUIPanel>().StudyOver(m_StudyController.GetAppraiseResult());
                    StartOrStopStudy();
                }
            }
            else
            {
                if (m_RefRateController.nCurrentFrame >= m_RefRateController.nTotalFrameCount)
                {
                    GetComponent <StudyModelUIPanel>().StudyOver(m_StudyController.GetAppraiseResult());
                    StartOrStopStudy();
                }
            }
        }
    }
コード例 #9
0
    private void Update()
    {
        if (bIsCalibrate)
        {
            m_RecordController.Update();
        }
        if (bIsStartRecord)
        {
            ModelCtrlData modelCtrlData = m_RecordController.GetCurrentData();
            m_FileWriter.CacheData(modelCtrlData);
            m_RecordModeChartController.UpdateLineChart(ChartType.CHART_SPEED, m_RecordRateController.nTotalFrameCount, TrailCurveDrawCtrl.Instance().lastSpeed(TrailType.EG_S1));
            m_RecordModeChartController.UpdateLineChart(ChartType.CHART_ACCELERATE, m_RecordRateController.nTotalFrameCount, TrailCurveDrawCtrl.Instance().lastAcceleration(TrailType.EG_S1));
            m_RecordModeChartController.UpdateLineChart(ChartType.CHART_CURVATURE, m_RecordRateController.nTotalFrameCount, TrailCurveDrawCtrl.Instance().lastCurvature(TrailType.EG_S1));
            m_RecordModeChartController.UpdateLineChart(ChartType.CHART_TORSION, m_RecordRateController.nTotalFrameCount, TrailCurveDrawCtrl.Instance().lastTorsion(TrailType.EG_S1));

            m_RecordRateController.nTotalFrameCount += 1;  //录制帧编号从0开始
        }
    }
コード例 #10
0
 private bool Init(GameObject model)
 {
     m_ModelController = model.GetComponent <ModelCtrl>();
     m_TrailController = TrailCurveDrawCtrl.Instance();
     return(true);
 }
コード例 #11
0
    private void Update()
    {
        if (bIsPlay)
        {
            var modelCtrlData = m_FileReader.PraseDataByFrameCount((int)m_VIdeoRateController.nCurrentFrame);
            m_PlayController.Update(modelCtrlData);
            m_PlayModeChartController.UpdateLineChart(ChartType.CHART_SPEED, m_VIdeoRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastSpeed(TrailType.EG_S1));
            m_PlayModeChartController.UpdateLineChart(ChartType.CHART_ACCELERATE, m_VIdeoRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastAcceleration(TrailType.EG_S1));
            //m_PlayModeChartController.UpdateLineChart(ChartType.CHART_CURVATURE, m_VIdeoRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastCurvature(TrailType.EG_S1));
            //m_PlayModeChartController.UpdateLineChart(ChartType.CHART_TORSION, m_VIdeoRateController.nCurrentFrame, TrailCurveDrawCtrl.Instance().lastTorsion(TrailType.EG_S1));

            m_VIdeoRateController.nCurrentFrame += m_VIdeoRateController.nAccelerate;
            if (m_VIdeoRateController.nCurrentFrame >= m_VIdeoRateController.nTotalFrameCount)
            {
                GetComponent <PlayRateControl>().OnStartOrStopClick();
            }
        }
    }