Add computeCentroids.