pointAt method

  1. @override
Vector2 pointAt(
  1. double t
)
override

Returns the point along the curve at the parameter value t.

Implementation

@override
Vector2 pointAt(double t) {
  final t2 = t * t;
  final mt = 1.0 - t;
  final mt2 = mt * mt;

  final a = mt2 * mt;
  final b = mt2 * t * 3;
  final c = mt * t2 * 3;
  final d = t * t2;

  final point = Vector2.copy(startPoint);
  point.scale(a);
  point.addScaled(points[1], b);
  point.addScaled(points[2], c);
  point.addScaled(points[3], d);

  return point;
}