Ejemplo n.º 1
0
    //--------------------------------------------------------------------------------------
    // Name: FilterAdaptiveDoubleExponential::UpdateSmoothingParameters()
    // Desc: Updates the smoothing parameters based on the smoothing filter's trend
    //--------------------------------------------------------------------------------------
    VOID FilterAdaptiveDoubleExponential::Update( const NUI_SKELETON_DATA* pSkeletonData, const FLOAT fDeltaTime  )
    {
        for (UINT i = 0; i < NUI_SKELETON_POSITION_COUNT; i++)
        {
            XMVECTOR vPreviousPosition  = m_DoubleExponentialFilter.m_History[ i ].m_vRawPosition;
            XMVECTOR vCurrentPosition   = pSkeletonData->SkeletonPositions[ i ];
            XMVECTOR vVelocity          = ( vCurrentPosition - vPreviousPosition ) / fDeltaTime;
            FLOAT fVelocity             = fabsf( XMVectorGetX( XMVector3Length( vVelocity ) ) );

            UpdateSmoothingParameters( i, fVelocity, pSkeletonData->eSkeletonPositionTrackingState[i] );

            m_DoubleExponentialFilter.Update( pSkeletonData, i, m_SmoothingParams[ i ] );
        }

        // Copy filtered data to output data
        XMemCpy( m_FilteredJoints, m_DoubleExponentialFilter.GetFilteredJoints(), sizeof( m_FilteredJoints ) );

    }
Ejemplo n.º 2
0
//--------------------------------------------------------------------------------------
// Name: FilterAdaptiveDoubleExponential::UpdateSmoothingParameters()
// Desc: Updates the smoothing parameters based on the smoothing filter's trend
//--------------------------------------------------------------------------------------
void FilterAdaptiveDoubleExponential::Update( const SKinSkeletonRawData& pSkeletonData, const float fDeltaTime  )
{
    for (uint32 i = 0; i < KIN_SKELETON_POSITION_COUNT; i++)
    {
        Vec4 vPreviousPosition  = m_DoubleExponentialFilter.m_History[ i ].m_vRawPosition;
        Vec4 vCurrentPosition   = pSkeletonData.vSkeletonPositions[ i ];
        Vec4 vVelocity          = ( vCurrentPosition - vPreviousPosition ) / fDeltaTime;
        float fVelocity             = fabsf( vVelocity.GetLength() );

        UpdateSmoothingParameters( i, fVelocity, pSkeletonData.eSkeletonPositionTrackingState[i] );

        m_DoubleExponentialFilter.Update( pSkeletonData, i, m_SmoothingParams[ i ] );
    }

    // Copy filtered data to output data
    memcpy( m_FilteredJoints, m_DoubleExponentialFilter.GetFilteredJoints(), sizeof( m_FilteredJoints ) );

}