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;
  final b = 2.0 * mt * t;
  final c = t2;

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

  return point;
}