area static method

dynamic area(
  1. dynamic contour
)

Implementation

static area(contour) {
  var n = contour.length;
  var a = 0.0;

  for (var p = n - 1, q = 0; q < n; p = q++) {
    a += contour[p].x * contour[q].y - contour[q].x * contour[p].y;
  }

  return a * 0.5;
}