public static Point getCentroid(Polygon poly) { enter code hereVector<Double> x = new Vector<Double>(); Vector<Double> y = new Vector<Double>(); for (int i = 0; i < poly.getPointCount(); i++) { x.add(poly.getPoint(i).getX()); y.add(poly.getPoint(i).getY()); } Envelope envelope = new Envelope(Collections.min(x), Collections.min(y), Collections.max(x), Collections.max(y)); return envelope.getCenter(); }
envelope.getCenter(point); return point;
envelope.getCenter(point); return point;