// Construteur. WidgetCourbe::WidgetCourbe(Time lifespan, const ConfigWidgetCourbe& config) : QWidget(), mLifespan(lifespan), mScroll(0), mFinish(false), mCourbes(), mConfig(config) { for (auto& courbe : mConfig.mCourbes) mCourbes.push_back(Courbe(courbe)); this->setMinimumSize(200, 50); }
Courbe Courbe::Chaikin(std::vector<point3> &listPoint, unsigned int depth) { std::vector<point3> newPoint; for(int i=0; i<listPoint.size(); i++){ newPoint.push_back( listPoint[i]+ (listPoint[(i+1)%listPoint.size()]-listPoint[i])*(1.0/4.0) ); newPoint.push_back( listPoint[i]+ (listPoint[(i+1)%listPoint.size()]-listPoint[i])*(3.0/4.0) ); } listPoint = newPoint; if(depth <= 1) return Courbe(newPoint); else return Chaikin(listPoint, depth-1); }