Пример #1
0
bool ObjectPosSelector::NextPosibleAngle( float& angle )
{
    // ++ direction less updated
    if( m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() && 
        (m_nextUsedPos[USED_POS_MINUS]==m_UsedPosLists[USED_POS_MINUS].end() || m_nextUsedPos[USED_POS_PLUS]->first <= m_nextUsedPos[USED_POS_MINUS]->first) )
    {
        bool ok;
        if(m_smallStepOk[USED_POS_PLUS])
            ok = NextSmallStepAngle(1.0,USED_POS_PLUS,angle);
        else
            ok = NextAngleFor(*m_nextUsedPos[USED_POS_PLUS],1.0,USED_POS_PLUS,angle);

        if(!ok)
            ++m_nextUsedPos[USED_POS_PLUS];                 // increase. only at fail (original or checked)
        return ok;
    }
    // -- direction less updated
    else if( m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end())
    {
        bool ok;
        if(m_smallStepOk[USED_POS_MINUS])
            ok = NextSmallStepAngle(-1.0,USED_POS_MINUS,angle);
        else
            ok =  NextAngleFor(*m_nextUsedPos[USED_POS_MINUS],-1.0,USED_POS_MINUS,angle);

        if(!ok)
            ++m_nextUsedPos[USED_POS_MINUS];
        return ok;
    }

    return false;
}
Пример #2
0
bool ObjectPosSelector::FirstAngle(float& angle)
{
    if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty() )
        return NextAngleFor(*m_UsedPosLists[USED_POS_MINUS].begin(), 1.0, USED_POS_PLUS, angle);
    else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty() )
        return NextAngleFor(*m_UsedPosLists[USED_POS_PLUS].begin(), -1.0, USED_POS_MINUS, angle);

    return false;
}