120 vect2_t p1 = points[0], p2 = points[1];
127 return (
fx_lin(x, p1.x, p1.y, p2.x, p2.y));
132 return (
fx_lin(x, p1.x, p1.y, p2.x, p2.y));
136 return (
fx_lin(x, p1.x, p1.y, p2.x, p2.y));
199 bool_t extrapolate,
size_t *num_out)
202 size_t cap = 0, num = 0;
208 for (
size_t i = 0; i + 1 < n_points; i++) {
209 vect2_t p1 = points[i], p2 = points[i + 1];
210 double min_val = MIN(p1.y, p2.y);
211 double max_val = MAX(p1.y, p2.y);
213 if (min_val <= y && y <= max_val)
224 for (
size_t i = 0; i + 1 < n_points; i++) {
225 vect2_t p1 = points[i], p2 = points[i + 1];
226 double min_val = MIN(p1.y, p2.y);
227 double max_val = MAX(p1.y, p2.y);
230 bool_t first = (i == 0);
231 bool_t up_slope = (p1.y <= p2.y);
232 if (first && ((up_slope && y < p1.y) ||
233 (!up_slope && y > p1.y)) && p1.y != p2.y) {
234 out[num++] =
fx_lin(y, p1.y, p1.x, p2.y, p2.x);
237 if (min_val <= y && y <= max_val)
238 out[num++] =
fx_lin(y, p1.y, p1.x, p2.y, p2.x);
241 bool_t up_slope = (p1.y <= p2.y);
242 if (last && ((up_slope && y > p2.y) ||
243 (!up_slope && y < p2.y)) && p1.y != p2.y) {
244 out[num++] =
fx_lin(y, p1.y, p1.x, p2.y, p2.x);
273 ASSERT3U(numpts, <=, MAX_PN_INTERP_ORDER);
275 memset(interp, 0,
sizeof (*interp));
276 interp->order = numpts;
278 for (
unsigned i = 0; i < numpts; i++) {
279 double terms[MAX_PN_INTERP_ORDER] = { 0 };
280 double product = 1.0;
283 for (
unsigned j = 0; j < numpts; j++) {
286 product *= points[i].x - points[j].x;
289 product = points[i].y / product;
292 for (
unsigned j = 0; j < numpts; j++) {
295 for (
int k = numpts - 1; k > 0; k--) {
296 terms[k] += terms[k-1];
297 terms[k-1] *= -points[j].x;
301 for (
unsigned j = 0; j < numpts; j++)
302 interp->coeff[j] += terms[j];
double * fx_lin_multi_inv3(double y, const struct vect2_s *points, size_t n_points, bool_t extrapolate, size_t *num_out)