Пример #1
0
int KComplexPath::GetEndVelocity()
{
    BOOL bRetCode = false;

    int nVelocityX   = 0;
    int nVelocityY   = 0;
    int nVelocityZ   = 0;
    int nTotalFrame  = 0;
    int nEndVelocity = 1000; // default if no pre path

    IPath* pPath = NULL;

    bRetCode = m_cSubPaths.empty();
    KG_PROCESS_SUCCESS(bRetCode);

    pPath = m_cSubPaths.back();
    KGLOG_PROCESS_ERROR(pPath);

    nTotalFrame = pPath->GetTotalFrame();
    pPath->GetVelocityByDeltaFrame(nTotalFrame, nVelocityX, nVelocityY, nVelocityZ);

    nEndVelocity = (int)sqrt((double)(nVelocityX * nVelocityX + nVelocityY * nVelocityY + nVelocityZ * nVelocityZ));

Exit1:
Exit0:
    return nEndVelocity;
}
Пример #2
0
IPath* KComplexPath::GetPathByDeltaFrame(int nDeltaFrame, int* pRetDeltaFrameInPath) const
{
    IPath* pResultPath = NULL;
    KCOMPLEX_SUB_PATHS::const_iterator itPaths;
    int nCurrentFrame = 0;
	
    KGLOG_PROCESS_ERROR(nDeltaFrame >= 0);
    KGLOG_PROCESS_ERROR(nDeltaFrame <= m_nTotalFrame);
	
    for (itPaths = m_cSubPaths.begin(); itPaths != m_cSubPaths.end(); ++itPaths)
    {
        IPath* pPath = *itPaths;
        int nTotalFrame = pPath->GetTotalFrame();
        if (nDeltaFrame <= nCurrentFrame + nTotalFrame)
        {
            pResultPath = pPath;
            if (pRetDeltaFrameInPath)
                *pRetDeltaFrameInPath = nDeltaFrame - nCurrentFrame;
            break;
        }
        nCurrentFrame += nTotalFrame;
    }
Exit0:
    return pResultPath;
}
Пример #3
0
void KComplexPath::Start(int nStartFrame)
{
    KCOMPLEX_SUB_PATHS::iterator itPaths;

    m_nStartFrame = nStartFrame;

    for (itPaths = m_cSubPaths.begin(); itPaths != m_cSubPaths.end(); ++itPaths)
    {
        IPath* pSubPath = (*itPaths);
        pSubPath->Start(nStartFrame);
        nStartFrame += pSubPath->GetTotalFrame();
    }
}