I have a ton of holes in some of my basics, but here is my problem.
I have a for loop. It loops through all of the instances contourFinder (which is working well so far), but once it tries to build polyline and pathFromContour, I can't figure out a way to link the contour ID ('i') to the newly created polyline and path.
void draw(){
for(int i = 0; i < n; i++) {
//FOR FILLING
ofPolyline polyline = contourFinder.getPolyline(i);//to convert
ofPath pathFromContour;//path to be built
for(int i = 0; i < polyline.getVertices().size(); i++) {
if(i == 0) {
pathFromContour.newSubPath();
pathFromContour.moveTo(polyline.getVertices()[i]);
} else {
pathFromContour.lineTo(polyline.getVertices()[i]);
}
}
pathFromContour.close();
pathFromContour.simplify();
ofColor pathColor(ofRandom(255),ofRandom(255),ofRandom(255));
pathFromContour.setFillColor(pathColor);
pathFromContour.draw();
}
}
Because of this, I can't seem to treat my paths or polylines differently. Could anybody explain what I might be doing wrong?
Thanks
i(the declaration in the innerfor"trumps" the outeriin the inner scope of the loop), that's certainly bad for readability.