Correctly calculate the centroid
Test with upward and downward slopes