Issue #45: Use correct size for centroid calculation