std::vector<Point> EasingFunction::getBezierPoints(std::vector<Point> controlPts, int nBezCurvePts){ std::vector<Point> pts; float u; int * C,k; C= new int[controlPts.size()]; binomialCoeffs(controlPts.size()-1,C); for(k = 0 ; k <= nBezCurvePts; k++){ Point pt; u = float(k) / float(nBezCurvePts); computeBezPt(u,&pt,controlPts.size(),controlPts,C); pts.push_back(pt); } delete[] C; return pts; }
void bezier(wcPt3D * ctrlPts, GLint nCtrlPts,GLint nBezCurvePts) { wcPt3D bezCurvePt; GLfloat u; GLint* C, k; C = new GLint[nCtrlPts]; binomialCoeffs(nCtrlPts-1,C); for( k = 0; k <= nBezCurvePts; k++) { u = GLfloat(k) / GLfloat(nBezCurvePts); computeBezPt(u,&bezCurvePt,nCtrlPts,ctrlPts,C); plotPoint(bezCurvePt); } delete [] C; }
Bezier::Bezier(int nCtrl, vector<v3d*> p, int nPts): nCtrl(nCtrl), points(p), nPts(nPts), cur(0) { C = new int[nCtrl]; binomialCoeffs(nCtrl-1, C); }