derivativePoints method

List<Vector2> derivativePoints({
  1. int derivativeOrder = 1,
})

Derivative points for the order derivativeOrder. Derivative points describe the derivative function of the polynomial function of this and are used by other methods to calculate derivative values.

Orders beyond the first are calculated with the previous order.

Implementation

List<Vector2> derivativePoints({int derivativeOrder = 1}) {
  if (derivativeOrder == 1) {
    return firstOrderDerivativePoints;
  } else if (derivativeOrder > this.order) {
    return [];
  } else if (derivativeOrder < 1) {
    throw ArgumentError('invalid order for derivatives');
  }

  final pointsToProcess =
      derivativePoints(derivativeOrder: derivativeOrder - 1);

  return computeDerivativePoints(pointsToProcess);
}