CatmullRomSpline.precompute constructor

CatmullRomSpline.precompute(
  1. List<Offset> controlPoints, {
  2. double tension = 0.0,
  3. Offset? startHandle,
  4. Offset? endHandle,
})

Constructs a centripetal Catmull-Rom spline curve.

The same as CatmullRomSpline.new, except that the internal data structures are precomputed instead of being computed lazily.

Implementation

CatmullRomSpline.precompute(
    List<Offset> controlPoints, {
      double tension = 0.0,
      Offset? startHandle,
      Offset? endHandle,
    }) : assert(tension <= 1.0, 'tension $tension must not be greater than 1.0.'),
         assert(tension >= 0.0, 'tension $tension must not be negative.'),
         assert(controlPoints.length > 3, 'There must be at least four control points to create a CatmullRomSpline.'),
         _controlPoints = null,
         _startHandle = null,
         _endHandle = null,
         _tension = null,
         _cubicSegments = _computeSegments(controlPoints, tension, startHandle: startHandle, endHandle: endHandle);