getSolverArea method

double getSolverArea (List<Position> positions)

Implementation

double getSolverArea(List<Position> positions) {
  double area = 0.0;
  for (int i = 0; i < _bodies.length; ++i) {
    final int next = (i == _bodies.length - 1) ? 0 : i + 1;
    area += positions[_bodies[i]._islandIndex].c.x *
            positions[_bodies[next]._islandIndex].c.y -
        positions[_bodies[next]._islandIndex].c.x *
            positions[_bodies[i]._islandIndex].c.y;
  }
  area *= .5;
  return area;
}