void AnimatedShadow::insertHole( ofPolyline &holeContourLine ){
    if (shapes.size() > 0){
        holeContourLine.setClosed(true);    
        holeContourLine.simplify(1);
        
        int lastFrame = shapes.size()-1;
        shapes[lastFrame].hole = holeContourLine.getSmoothed(1,1);
        shapes[lastFrame].haveHole = true;
    }
}
Пример #2
0
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    switch(key) {
        case 'R': bRotate ^= true; if(!bRotate) rotAngle = 0; break;
        case 'r': poly.clear(); break;
        case 'c': poly.curveTo(mouseX, mouseY); break;
        case 'a': poly.arc(mouseX, mouseY, 50, 50, 0, 180); break;
        case 'o': poly.setClosed(!poly.isClosed()); break;
            
        case 'F': poly.simplify(10); break;
        case 'M': poly = poly.getSmoothed(5); break;
        case 'S': poly = poly.getResampledBySpacing(30); break;
        case 'C': poly = poly.getResampledByCount(50); break;
            
        case 'l': poly.setClosed(!poly.isClosed());
            
        case 'i': poly.insertVertex(ofPoint(mouseX, mouseY, 0), nearestIndex); break;
    }
}
Пример #3
0
vector<ofMesh> pen::createStrokes(ofPolyline myLine , ofColor mainColor){
    
    vector<ofMesh> strokes; 
    
    //if (myLine.size() > 3)
    //    currentLine.simplify();
    //currentLine = currentLine.getResampledBySpacing(10);
    myLine = myLine.getSmoothed(80);
    
    strokes.push_back(lineToMesh(myLine, ofColor(0,0,0,100), 5, ofVec2f(0,0)));
    //strokes.push_back(p.lineToMesh(myLine, ofColor(5,5,5), 12, ofVec2f(3,3) ));
    
    ofMesh mesh = lineToMesh(myLine, mainColor);
    strokes.push_back(extrudeMesh(mesh,mainColor));
    strokes.push_back(mesh);
    
    return strokes;
}
void AnimatedShadow::addFrame( ofPolyline &_contourLine, int _nFingers){
    
    if ( _nFingers > 0 ){
        bHand = true;
    }
    
    if ( _contourLine.size() > 0){
        _contourLine.setClosed(true);  
        _contourLine.simplify(1);
        
        ShadowShape newShape;
        newShape.contour = _contourLine.getSmoothed(2,1);
        newShape.haveHole = false;
        newShape.time = ofGetElapsedTimef() - startTime;
        //newShape.interv = -1;
        shapes.push_back( newShape );
    }
    
    bActive = false;
}
Пример #5
0
void testApp::setup(){
    ofSetFrameRate(60);
    mesh.simplify(1.);
    mesh.getSmoothed(3);
}