35 ControlPoints * pointsList;
42 pointsList =
new ControlPoints[inputs];
43 for (
int i=0; i<inputs; i++) pointsList[i].n = 0;
53 assert (input >= 0 && input < inputs);
54 assert (n >= 0 && n <= 8);
56 ControlPoints * p = pointsList + input;
58 if (n != 0 && p->n == 0) inputs_used++;
59 if (n == 0 && p->n != 0) inputs_used--;
60 assert(inputs_used >= 0);
61 assert(inputs_used <= inputs);
66 void set_point (
int input,
int index,
float x,
float y)
68 assert (input >= 0 && input < inputs);
69 assert (index >= 0 && index < 8);
70 ControlPoints * p = pointsList + input;
71 assert (index < p->n);
74 assert (x >= p->xvalues[index-1]);
77 p->xvalues[index] = x;
78 p->yvalues[index] = y;
83 return inputs_used == 0;
93 if (inputs_used == 0)
return result;
95 for (j=0; j<inputs; j++) {
96 ControlPoints * p = pointsList + j;
103 float x0, y0, x1, y1;
110 for (i=2; i<p->n && x>x1; i++) {
121 y = (y1*(x - x0) + y0*(x1 - x)) / (x1 - x0);