could you make the polynomInterpolation() to generalized function to support multiple control point ? to support unlimited control points.

i.e. WaveformComponent::polynomInterpolation(int *points, int num_points, int x);

Additionally, do you know how to make curve function inside MS Powerpoint ?

Callee:

double WaveformComponent::polynomInterpolation(double x)

{

double x0, y0, x1, y1, x2, y2, x3, y3, b0, b1, b2, b3;

x0 = leftKnot->getX();

y0 = leftKnot->getY();

x3 = rightKnot->getX();

y3 = rightKnot->getY();

```
x1 = lmKnot->getX();
y1 = lmKnot->getY();
x2 = rmKnot->getX();
y2 = rmKnot->getY();
b0 = y0;
b1 = (y1 - y0) / (x1 - x0);
b2 = (y2 - y0 - b1 * (x2 - x0)) / ((x2 - x0) * (x2 - x1));
b3 = (y3 - y0 - b1 * (x3 - x0) - b2 * (x3 - x0)*(x3 - x1)) / ((x3 - x0) * (x3 - x1) * (x3 - x2));
double y = b0 + (x - x0)*(b1 + (x - x1)*(b2 + b3 * (x - x2)));
return y;
```

}

Caller:

if(_waveFormType == PolynomInterpolation)

{

#if 0

for (int i=0; i<getWidth(); i++)

{

int j = (int)polynomInterpolation(i);

g.setPixel(i, j);

}

#else

Path path;

for (int i=0; i<getWidth(); i++)

{

int j = (int)polynomInterpolation(i);

if (i == 0)

{

path.startNewSubPath(0, j);

}

else

{

path.lineTo(i, j);

}

}

g.strokePath(path, PathStrokeType(1.0f));

#endif

}