getArcLength method

double getArcLength({
  1. int? numSamplePoints,
})

Implementation

double getArcLength({int? numSamplePoints}) {
  numSamplePoints ??= 4 * getNumCurves() + 1;

  var points = [
    for (var alpha
        in linspace(start: 0, end: 1, count: numSamplePoints).getColumn(0))
      pointFromProportion(alpha)
  ];

  var diffs = [
    for (var i in range(end: numSamplePoints - 1)) points[i + 1] - points[i]
  ];

  var norms = diffs.map((v) => v.norm()).toList();
  return sum(norms);
}