예제 #1
0
LetterList LSystem::getRule(Letter l)
{
    if (isVariable(l)) {
        int i = l - V_0;
        return m_rules.at(i);
    } else {
        LetterList ll;
        ll.push_back(l);
        return ll;
    }
}
예제 #2
0
    void moveLetters(float adjust)
    {
        float adaptedMoveSpeed = this->moveSpeed * adjust;
        float adaptedMorphSpeed = this->morphSpeed * adjust;
        postEffect->tick(adjust);

        for (int i=0; i<letters->size(); i++){
            LetterItem *letter = letters->at(i);
            letter->guideAdvance(this->morphBetweenModels ? adaptedMoveSpeed : Colors::tickerMoveSpeed);
            letter->guideMove(this->morphBetweenModels ? adaptedMorphSpeed : -1);

            QPointF pos = letter->getGuidedPos();
            postEffect->transform(letter, pos);

            if (useSheepDog)
                letter->setPosUsingSheepDog(pos, QRectF(0, 0, 800, 600));
            else
                letter->setPos(pos);
        }
    }
예제 #3
0
int LSystem::iterate(void)
{
    LetterList newlist;

    for (int i=0; i < m_list.size(); i++) {
        if (isVariable(m_list[i])) {
            LetterList rule = getRule(m_list[i]);
            newlist.insert(newlist.end(), rule.begin(), rule.end());
        } else {
            newlist.push_back(m_list[i]);
        }
    }

    m_list = newlist;
    m_depth++;
    return m_depth;
}
예제 #4
0
void LSystem::printList(LetterList list)
{
    using namespace std;
    cout << "size:" << list.size() << "| ";
    for (int i=0; i<list.size(); i++) {
        switch (list[i]) {
        case V_0:
            cout << "V0";
            break;
        case V_1:
            cout << "V1";
            break;
        case V_2:
            cout << "V2";
            break;
        case V_3:
            cout << "V3";
            break;
        case V_4:
            cout << "V4";
            break;
        case V_5:
            cout << "V5";
            break;
        case V_6:
            cout << "V6";
            break;
        case V_7:
            cout << "V7";
            break;
        case V_8:
            cout << "V8";
            break;
        case V_9:
            cout << "V9";
            break;
        case C_PLUS:
            cout << "+";
            break;
        case C_MINUS:
            cout << "-";
            break;
        case C__PLUS:
            cout << "++";
            break;
        case C__MINUS:
            cout << "--";
            break;
        case C_F:
            cout << "F";
            break;
        case C_G:
            cout << "G";
            break;
        case C_BRACK__:
            cout << "[";
            break;
        case __C_BRACK:
            cout << "]";
            break;
        case C_0:
            cout << "C0";
            break;
        case C_1:
            cout << "C1";
            break;
        case C_2:
            cout << "C2";
            break;
        case C_3:
            cout << "C3";
            break;
        case C_4:
            cout << "C4";
            break;
        default:
            cout << "ERROR";
            break;
        }
        cout << " ";
    }
    cout << "\n";
}