getCurveLengths method

List<num> getCurveLengths()

Implementation

List<num> getCurveLengths() {
  // We use cache values if curves and cache array are same length

  if (cacheLengths != null && cacheLengths!.length == curves.length) {
    return cacheLengths!;
  }

  // Get length of sub-curve
  // Push sums into cached array

  List<num> lengths = [];
  num sums = 0.0;

  for (var i = 0, l = curves.length; i < l; i++) {
    sums += curves[i].getLength();
    lengths.add(sums);
  }

  cacheLengths = lengths;

  return lengths;
}