Beispiel #1
0
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;
}
Beispiel #2
0
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;
}