getBodyArea method

double getBodyArea ()

Implementation

double getBodyArea() {
  double area = 0.0;
  for (int i = 0; i < _bodies.length; ++i) {
    final int next = (i == _bodies.length - 1) ? 0 : i + 1;
    area += _bodies[i].worldCenter.x * _bodies[next].worldCenter.y -
        _bodies[next].worldCenter.x * _bodies[i].worldCenter.y;
  }
  area *= .5;
  return area;
}