code: private static Point2D getPolygonSansHolesCentroid(Polygon polygon)
      {
          int pointCount = polygon.getPointCount();
          double xSum = 0;
          double ySum = 0;
          double signedArea = 0;
  
          Point2D current = new Point2D();
          Point2D next = new Point2D();
          for (int i = 0; i < pointCount; i++) {
              polygon.getXY(i, current);
              polygon.getXY((i + 1) % pointCount, next);
              double ladder = current.x * next.y - next.x * current.y;
              xSum += (current.x + next.x) * ladder;
              ySum += (current.y + next.y) * ladder;
              signedArea += ladder / 2;
          }
          return new Point2D(xSum / (signedArea * 6), ySum / (signedArea * 6));
      }
docs: c[y] = (Sigma(y[i] + y[i + 1]) * (x[i] * y[i + 1] - x[i + 1] * y[i]), for i = 0 to N - 1) / (6 * signedArea)