Ported Centroid
Test cases for Centroid