Computing area and centroid in same loop