Actually calculate centroids.