getCurveLengths method

List<double> getCurveLengths()

Implementation

List<double> 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<double> lengths = [];
  double sums = 0.0;

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

  cacheLengths = lengths;

  return lengths;
}