Computing centroids.