Added centroid calculation for vectors.