CatmullRomCurve.precompute constructor

CatmullRomCurve.precompute(
  1. List<Offset> controlPoints, {
  2. double tension = 0.0,
})

Constructs a centripetal CatmullRomCurve.

Same as CatmullRomCurve.new, but it precomputes the internal curve data structures for a more predictable computation load.

Implementation

CatmullRomCurve.precompute(this.controlPoints, {this.tension = 0.0})
    : assert(() {
        return validateControlPoints(
          controlPoints,
          tension: tension,
          reasons: _debugAssertReasons..clear(),
        );
      }(), 'control points $controlPoints could not be validated:\n  ${_debugAssertReasons.join('\n  ')}'),
      // Pre-compute samples so that we don't have to evaluate the spline's inverse
      // all the time in transformInternal.
      _precomputedSamples = _computeSamples(controlPoints, tension);