rightSubcurveAt method

Bezier rightSubcurveAt(
  1. double t
)

Returns the subcurve obtained by taking the portion of the curve to the right of parameter value t.

Implementation

Bezier rightSubcurveAt(double t) {
  if (t >= 1.0) {
    throw ArgumentError('Cannot split curve right of end point');
  }

  t = max(t, 0.0);

  final hullPoints = hullPointsAt(t);
  if (order == 2) {
    return QuadraticBezier([hullPoints[5], hullPoints[4], hullPoints[2]]);
  } else if (order == 3) {
    return CubicBezier(
        [hullPoints[9], hullPoints[8], hullPoints[6], hullPoints[3]]);
  } else {
    throw UnsupportedError('Unsupported curve order');
  }
}