pointwiseBecomePartial method

  1. @override
void pointwiseBecomePartial(
  1. Mobject mob,
  2. double a,
  3. double b
)
override

Implementation

@override
void pointwiseBecomePartial(Mobject mob, double a, double b) {
  assert(mob is VMobject);
  var vmob = mob as VMobject;

  if (a <= 0 && b >= 1) {
    setPoints(vmob.getPoints());
    return;
  }

  var bezierQuads = mob.getCubicBezierTuples();
  var numCubics = bezierQuads.length;

  var lower = integerInterpolate(0, numCubics, a);
  var upper = integerInterpolate(0, numCubics, b);

  var lowerIndex = lower.item1;
  var lowerResidue = lower.item2;
  var upperIndex = upper.item1;
  var upperResidue = upper.item2;

  clearPoints();

  if (numCubics == 0) {
    return;
  }

  if (lowerIndex == upperIndex) {
    appendPoints(partialBezierPoints(
        bezierQuads[lowerIndex].toList().cast<Vector3>(),
        lowerResidue,
        upperResidue));
  } else {
    appendPoints(partialBezierPoints(
        bezierQuads[lowerIndex].toList().cast<Vector3>(), lowerResidue, 1));

    for (var quad in bezierQuads.getRange(lowerIndex + 1, upperIndex)) {
      appendPoints(quad.toList().cast<Vector3>());
    }

    appendPoints(partialBezierPoints(
        bezierQuads[upperIndex].toList().cast<Vector3>(), 0, upperResidue));
  }
}