Ejemplo n.º 1
0
void testApp::addGeneration(){
    vector<KochLine> newLines;
    
    for(int i=0; i<lineList.size(); i++){
        ofVec2f a=lineList[i].a();
        ofVec2f b=lineList[i].b();
        ofVec2f c=lineList[i].c();
        ofVec2f d=lineList[i].d();
        ofVec2f e=lineList[i].e();
        
        newLines.push_back( KochLine(a, b) );
        newLines.push_back( KochLine(b, c) );
        newLines.push_back( KochLine(c, d) );
        newLines.push_back( KochLine(d, e) );

    }
    
    lineList = newLines;
}
Ejemplo n.º 2
-1
//--------------------------------------------------------------
void ofApp::setup(){
    
    start.set(0,200);
    ending.set(ofGetWidth(), 200);
    
    //KochLine.setup(start, ending);
    
    lines.push_back( KochLine(start,ending) );
    
    for(int i = 0; i < 5; i++){
        generate();
    }
}
Ejemplo n.º 3
-2
//////////////////Exercise 8.2///////////////////////////
void ofApp::generate(){
    for(KochLine l : lines){
        ofVec2f a = l.kochA();
        ofVec2f b = l.kochB();
        ofVec2f c = l.kochC();
        ofVec2f d = l.kochD();
        ofVec2f e = l.kochE();
        
        next.push_back(KochLine(a,b));
        next.push_back(KochLine(b,c));
        next.push_back(KochLine(c,d));
        next.push_back(KochLine(d,e));
    }
    lines = next;
}