
#include "contourAnalyser.h"

//---------------------------------------------
contourAnalyser::contourAnalyser(){
}
	
	
//---------------------------------------------
void contourAnalyser::smoothContour(ofxCvBlob blob, vector <ofxVec2f> & smoothedPts,  float smoothAmnt){
	
	smoothedPts.clear();
	smoothedPts.assign(blob.nPts, ofxVec2f());
	
	smoothedPts[0].x = blob.pts[0].x;
	smoothedPts[0].y = blob.pts[0].y;
	
	for (int j = 1; j < blob.nPts; j++){
		smoothedPts[j].x = blob.pts[j].x;
		smoothedPts[j].y = blob.pts[j].y;

		smoothedPts[j].x = smoothedPts[j].x * (1.0 - smoothAmnt)  + smoothedPts[j-1].x * smoothAmnt;
		smoothedPts[j].y = smoothedPts[j].y * (1.0 - smoothAmnt)  + smoothedPts[j-1].y * smoothAmnt;
	}
	
}
	

