diff options
Diffstat (limited to 'drawing')
| -rw-r--r-- | drawing/src/lineSegmenter.cpp | 2 | ||||
| -rw-r--r-- | drawing/src/ofApp.cpp | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/drawing/src/lineSegmenter.cpp b/drawing/src/lineSegmenter.cpp index 7e0af7a..14f6e24 100644 --- a/drawing/src/lineSegmenter.cpp +++ b/drawing/src/lineSegmenter.cpp @@ -1,4 +1,4 @@ -#include "lineSegmenter.h" + #include "lineSegmenter.h" const vector <ofPolyline> & lineSegmenter::getSegments(int num,float coverage, float phase){ //num - number of segments diff --git a/drawing/src/ofApp.cpp b/drawing/src/ofApp.cpp index 4b25356..da00262 100644 --- a/drawing/src/ofApp.cpp +++ b/drawing/src/ofApp.cpp @@ -12,16 +12,26 @@ void ofApp::setup(){ svg.load("lorenzo.svg"); imagepaths= svg.getPaths(); + float simplify_factor=0.3f; + + std::stringstream strm; + for (auto& path:imagepaths){ path.setPolyWindingMode(OF_POLY_WINDING_ODD); + + vector <ofPolyline> outlines= path.getOutline(); for (auto& outline:outlines){ + strm << outline.size() << "->"; + outline.simplify(simplify_factor); + strm << outline.size() << " "; segmenters.push_back(lineSegmenter(outline)); } + strm << " , "; } - cout << "Drawing: found " << imagepaths.size() << " paths with " << segmenters.size() << " shapes" <<std::endl; + cout << "Drawing: found " << imagepaths.size() << " paths with " << segmenters.size() << " shapes [ " << strm.str() << " ]" <<std::endl; svg.load("lorenzo.svg"); maskpaths= svg.getPaths(); @@ -146,12 +156,18 @@ void ofApp::draw(){ switch (mode){ case 0:{ + //int s=((int)ofGetElapsedTimef())%segmenters.size(); + //lasershapes.push_back(segmenters[s].getPoly()); + for (auto shape=segmenters.begin();shape!=segmenters.end();shape++){ auto segments=shape->getSegments(numsegments,coverage,phase); + for (auto segment=segments.begin();segment!=segments.end();segment++){ lasershapes.push_back(colourPolyline(*segment)); } } + + break; } case 1:{ |
