signedArea function

double signedArea(
  1. List<double> data,
  2. int start,
  3. int end,
  4. int dim,
)

Implementation

double signedArea(List<double> data, int start, int end, int dim) {
  double sum = 0.0;
  for (int i = start, j = end - dim; i < end; i += dim) {
    sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
    j = i;
  }

  return sum;
}