lerp method

Polynomial<T> lerp(
  1. Polynomial<T> other,
  2. num t, {
  3. DataType<T>? dataType,
  4. PolynomialFormat? format,
})

Interpolates linearly between this Polynomial and other with a factor of t. If t is equal to 0 the result is this, if t is equal to 1 the result is other.

Implementation

Polynomial<T> lerp(Polynomial<T> other, num t,
    {DataType<T>? dataType, PolynomialFormat? format}) {
  final result = createPolynomial<T>(
      this, math.max(degree, other.degree), dataType, format);
  final add = result.dataType.field.add, scale = result.dataType.field.scale;
  binaryOperator<T>(
      result, this, other, (a, b) => add(scale(a, 1.0 - t), scale(b, t)));
  return result;
}