From 28718e114696f1d5d735992c29f8e0b1dd83a90d Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 19 Apr 2023 12:01:10 +0100 Subject: WIP some svg stuff working --- nextus/src/vectorPlugin.cpp | 148 +++++++++++++++++++++++--------------------- 1 file changed, 76 insertions(+), 72 deletions(-) (limited to 'nextus/src/vectorPlugin.cpp') diff --git a/nextus/src/vectorPlugin.cpp b/nextus/src/vectorPlugin.cpp index 03b7eaa..c87de08 100644 --- a/nextus/src/vectorPlugin.cpp +++ b/nextus/src/vectorPlugin.cpp @@ -53,7 +53,7 @@ void svgPanel::load(string filename){ path.getStrokeColor() ) ); - //shape_selection_durations.push_back(0.0f); + shape_selection_durations.push_back(0.0f); } //strm << " , "; @@ -61,21 +61,13 @@ void svgPanel::load(string filename){ //std::stringstream strom; - //shape_selection.clear(); - //while (shape_selection.size()<(segmenters.size()*shapes_amount)){ - // int selection=(int)ofRandom(0,segmenters.size()); - // shape_selection.insert(selection); - //} - //for (auto s:shape_selection){ - // float spawn=(ofRandom(0,(float)shapes_duration)); - // shape_selection_durations[s]=spawn; - // strom << s << ":"<0.0f){ - shape_selection_durations[i]=shape_selection_durations[i]-timedelta; - } +void svgPanel::select_random_shapes(){ + + shape_selection.clear(); + while (shape_selection.size()<(segmenters.size()*shapes_amount)){ + int selection=(int)ofRandom(0,segmenters.size()); + shape_selection.insert(selection); + } + for (auto s:shape_selection){ + float spawn=(ofRandom(0,(float)shapes_duration)); + shape_selection_durations[s]=spawn; + //strom << s << ":"<0.0f){ + if (shape_selection_durations[i]>timedelta){ + shape_selection_durations[i]-=timedelta; shape_selection.insert(i); } } + + // + + /* std::stringstream strom; for (auto& s:shape_selection){ strom << s <<":"< svgPanel::getAllLines(){ vector svgPanel::getLines(){ vector output; - return output; + //if (!use_onset||onset_framegetSegments(segmenter_number,segmenter_length,phase); - for (auto segment=segments.begin();segment!=segments.end();segment++){ - //output.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); - output.push_back(*segment); - } - } - else { - //output.push_back(colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); - output.push_back(shape->getPoly()); + framecounter--; + } + else { + for (auto shape=segmenters.begin();shape!=segmenters.end();shape++){ + if (use_segmenter){ + auto segments=shape->getSegments(segmenter_number,segmenter_length,phase); + for (auto segment=segments.begin();segment!=segments.end();segment++){ + //output.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); + output.push_back(*segment); } } - } - /* - this should happen at output stage? - - if (contour_useColour){ - vector newPolys; - for (auto p: output){ - newPolys.push_back(colourPolyline((ofPolyline)p,ofColor(laser_R,laser_G,laser_B))) ; + else { + //output.push_back(colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); + output.push_back(shape->getPoly()); } - output=newPolys; } - */ - //} + } + /* + this should happen at output stage? + if (contour_useColour){ + vector newPolys; + for (auto p: output){ + newPolys.push_back(colourPolyline((ofPolyline)p,ofColor(laser_R,laser_G,laser_B))) ; + } + output=newPolys; + } + */ +//} + return output; } \ No newline at end of file -- cgit v1.2.3