Function S2Polygon.getCentroid

Return the true centroid of the polygon multiplied by the area of the polygon (see s2centroids.h for details on centroids). The result is not unit length, so you may want to normalize it. Also note that in general, the centroid may not be contained by the polygon.

s2.util.math.vector.Vector!(double,3L) getCentroid() const;

We prescale by the polygon area for two reasons: (1) it is cheaper to compute this way, and (2) it makes it easier to compute the centroid of more complicated shapes (by splitting them into disjoint regions and adding their centroids).