signedArea function

dynamic signedArea(
  1. dynamic data,
  2. dynamic start,
  3. dynamic end,
  4. dynamic dim,
)

Implementation

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

  return sum;
}