position method

  1. @override
double position(
  1. double distance
)
override

Implementation

@override
double position(final double distance) {
  if (distance < 0 || distance > 1) {
    throw ArgumentError.value(
        distance, 'distance', 'Distance must be beteen 0 and 1.');
  }

  return 0.5 *
      ((2 * _p1) +
          (_p2 - _p0) * distance +
          (2 * _p0 - 5 * _p1 + 4 * _p2 - _p3) * distance * distance +
          (3 * _p1 - _p0 - 3 * _p2 + _p3) * distance * distance * distance);
}